473,320 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

inline function question

I was writing an example from a book of Borland C++. At is wrote as it
is. I found those errors :
Can't have a non-inline function in a local class
Identifier GetX can't have a type qualifier.
Here is the code :
*-----------------

#include <stdio.h>
main (void)
{
enum boolean { false , true };

// This the second method of declaration
struct point
{
int X,Y;
boolean visible;
int GetX2();
};

int point::GetX()
{
int n=9;
return n;
};

return 0;
}
Nov 14 '05 #1
2 1293
hp******@yahoo.com <eh***********@yahoo.com> scribbled the following
on comp.lang.c:
I was writing an example from a book of Borland C++. At is wrote as it
is. I found those errors :
Can't have a non-inline function in a local class
Identifier GetX can't have a type qualifier.
Here is the code :


Why are you posting C++ code to comp.lang.c? Why not try
comp.lang.fortran while you're at it?

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"You have moved your mouse, for these changes to take effect you must shut down
and restart your computer. Do you want to restart your computer now?"
- Karri Kalpio
Nov 14 '05 #2
"hp******@yahoo.com" <eh***********@yahoo.com> wrote...
I was writing an example from a book of Borland C++. At is wrote as it
is.
How old is the book?
I found those errors :
Can't have a non-inline function in a local class
Identifier GetX can't have a type qualifier.
Yes. What's your question? What to do? Put the body of the
offending function inside the class definition.
Here is the code :
*-----------------

#include <stdio.h>
main (void)
int main()
{
enum boolean { false , true };
'bool' is now a built-in type. You don't need your 'boolean' any
longer.

// This the second method of declaration
struct point
{
int X,Y;
boolean visible;
int GetX2();
};

int point::GetX()
'point' does NOT have 'GetX' member. You need to have your names
straight. It's either 'GetX2' (as in the class definition) or 'GetX',
then you need to fix the class definition.
{
int n=9;
return n;
};

return 0;
}


Besides, you never use your 'struct point'. So, what's the point
(the pun's intended)?

Victor
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Grumble | last post by:
Hello everyone, As far as I understand, the 'inline' keyword is a hint for the compiler to consider the function in question as a candidate for inlining, yes? What happens when a function with...
4
by: Tony Johansson | last post by:
Hello experts! I'm reading a book about C++ and there is something about inline that the book says that is unclear for me. The book says the following "Because inline functions are expanded at...
5
by: Tony Johansson | last post by:
Hello experts! I reading a book called programming with design pattern revealed by Tomasz Muldner and here I read something that sound strange. Here is the whole section: It says" Because...
8
by: John Ratliff | last post by:
Can the compiler ever inline a method when there is a pointer to the member used? Thanks, --John Ratliff
7
by: Wu Shaohua | last post by:
Hi Guys, 1. As we know usually we should not define a constructor as inline. I also learned if we define a member function inside the class this member function will be automatically be...
7
by: ypjofficial | last post by:
Hello All, Inline before a function definition is just a request to the compiler to make the function inline. The compiler may or maynot make it inline.. My question is ..is there any way by...
25
by: toton | last post by:
Hi, As inline is not mandetory, it depends on compiler to inline certain function (or using switch like fior GCC), my question is there any scope for inlining when it is not declared as inline...
12
by: sam_cit | last post by:
Hi Everyone, I have few questions on inline functions, when i declare a function as inline, is it for sure that the compiler would replace the function call with the actual body of the function?...
14
by: jg | last post by:
Does C++ standard require an inline function be generated all the time ? For example, #include <iostream> using namespace std; inline int foo() {
6
by: Laurent Deniau | last post by:
When I compile the code below with gcc -std=c99 -W -Wall -pedantic -O3 -Winline, it reports the following: variadic.c: In function ‘fv’: variadic.c:12: warning: function ‘fv’ can never be...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.