Seems that the ILE C compiler does not bother with the missing inline on
the prototype: no error or warning on compilation.

But I still have to use the "old" C89 style inline keyword "__inline"
instead of just "inline". Is there a compile option to use the newer
keyword definition "inline"?

Thanx

Mihael

-----Original Message-----
From: c400-l-bounces+mihael.schmidt=rossmann.de@xxxxxxxxxxxx
[mailto:c400-l-bounces+mihael.schmidt=rossmann.de@xxxxxxxxxxxx] On
Behalf Of Mike Amos
Sent: Thursday, February 04, 2010 7:38 PM
To: C programming iSeries / AS400
Subject: Re: [C400-L] problem with inline function

Sorry that I didn't notice this before. Your prototype does not include
the inline keyword. The ILE C/C++ compiler is extremely picky about
these specification requirements whereas most other compilers either
issue a miner warning or nothing at all (which is not compliant). Change

your prototype to

inline int add_value(int x, int y);

and your implementation to

inline int add_value(int x, int y)
{
return x + y;
}

This implements all of my recommended changes.

Mike

Hi,

I got a little problem with inlining a function in the following
example code:


// Prototypes
int add_value(int x, int y);


int main(int argc, char **argv)
{
int returnValue = 0;

int x = 2;
int y = 0;

int z = add_value(x, y);

return returnValue;

}

static inline int add_value(int x, int y)
{
return x + y;
};
If i try to compile this I get:



This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact [javascript protected email address].