Thanx for your quick answer.

Works.

Mihael

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

This does the same job, I suppose:

int add_value(int x, int y) ;

#pragma inline (add_value)

int main()
{
int ReturnValue = 0 ;
int x = 2 ;
int y = 0 ;
int z = add_value(x,y) ;
return(ReturnValue) ;
}
int add_value(int x, int y)
{
return(x + y) ;
}


-----Original Message-----
From: c400-l-bounces+jevgeni.astanovski=sampopank.ee@xxxxxxxxxxxx [mailto:c400-l-bounces+jevgeni.astanovski=sampopank.ee@xxxxxxxxxxxx] On Behalf Of Schmidt, Mihael
Sent: 4. veebruar 2010. a. 14:41
To: C programming iSeries / AS400
Subject: Re: [C400-L] problem with inline function

Hi,

after some research changing

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

to

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

did it though I actually don't know why. Which is now the easiest way to let the compiler accept inline or change the source in a maintainble fashion?

Thanx in advance

Mihael

-----Original Message-----
From: c400-l-bounces+mihael.schmidt=rossmann.de@xxxxxxxxxxxx [mailto:c400-l-bounces+mihael.schmidt=rossmann.de@xxxxxxxxxxxx] On Behalf Of Schmidt, Mihael
Sent: Thursday, February 04, 2010 10:55 AM
To: C programming iSeries / AS400
Subject: [C400-L] problem with inline function

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:

/home/schmidt/main.c, 20.1: CZM0277(30) Syntax error: possible missing
';' or ','?
/home/schmidt/main.c, 19.8: CZM0485(30) Parameter declaration list is
incompatible with declarator for inline.

I have looked in the compiler reference, language reference and programmers guide but can't find out what is wrong. Any help is appreciated.

BTW adding INLINE(*ON) on the CRTCMOD command didn't help either.

Thanx in advance

Mihael Schmidt
Anwendungsentwicklung

Dirk Rossmann GmbH
Iserhägener Str.16
30938 Burgwedel
* +49 (05139) 898 - 4353

Handelsregister-Nr. HRB 120546, Amtsgericht Hannover
Ust-Id-Nr. DE 115055186
St.-Nr. 16 / 205 / 65401
Geschäftsführer: Dirk Roßmann, Alice Schardt-Roßmann, Roland Frobel, Klaus Praus


This thread ...

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 on our policy page. If you have questions about this, please contact [javascript protected email address].