× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thank you very much for the explanation and the code. I will give it a try.

inline: I think using the pragma approach is the easiest as I have the least code to change.

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 Aaron Albertson
Sent: Tuesday, February 01, 2011 6:08 PM
To: C programming iSeries / AS400
Subject: Re: [C400-L] inline function


Hi Mihael,

I have an explanation of the inline behavior, just to put your mind at ease
a little bit. The 'inline' keyword was introduced in the C language in the
C99 version of the standard. The IBM i C compiler does not yet fully
support the C99 standard, and this is one of the features that has not yet
been added. The compiler documentation is misleading, in that it implies
that the inline keyword can be used in both C and C++. For C you need to
use either '__inline' or '#pragma inline'.

For the macro, it would probably be easiest for you to create a C module
containing a small function that uses the rbtree_container_of macro. You
could call the C function from your RPG code. This wouldn't work for
arbitrary structures, but I'm guessing that you only have a few structures
that you care about. You would need to create a function for each
structure.

I talked with RPG guru Barbara Morris, and here's something similar you can
do in RPG (formatting is off, but you get the idea):

D container_t ds qualified template
D i 10i 0
D j 10i 0
D container ds likeds(container_t)
D offsets ds likeds(container_t)
D pNode s *
D pContainer s *
/free
pNode = %addr(container.j);
pContainer = pNode - (%addr(offsets.j) - %addr(offsets));



...

Aaron




From: "Schmidt, Mihael" <Mihael.Schmidt@xxxxxxxxxxx>
To: "'C programming iSeries / AS400'" <c400-l@xxxxxxxxxxxx>
Date: 02/01/2011 08:37 AM
Subject: Re: [C400-L] inline function
Sent by: c400-l-bounces+albertaa=us.ibm.com@xxxxxxxxxxxx



The enum doesn't seem to be the problem.

I now tried it with __inline instead of inline. That at least compiled.
Google says that __inline is vendor/implementation specific.

I think I'll leave it at that.

But now I got another problem. The C header file defines a function:

# define rbtree_container_of(node, type, member)
\
((type *)((char *)(node) - offsetof(type, member)))


This is a function I must use in my RPG program. How to do that?

It seems I am out of luck. Any ideas?

Thanx so far.

Mihael




-----Original Message-----
From: c400-l-bounces+mihael.schmidt=rossmann.de@xxxxxxxxxxxx [
mailto:c400-l-bounces+mihael.schmidt=rossmann.de@xxxxxxxxxxxx] On Behalf Of
Dennis
Sent: Tuesday, February 01, 2011 2:44 PM
To: C programming iSeries / AS400
Subject: Re: [C400-L] inline function

I wonder if it's the enum that's actually presenting you with a problem.
How do the other static inline's compile? All good? Some good? (Sorry, I
lack a C compiler when I'm at work, and I lack i6.1 altogether.

"Schmidt, Mihael" <Mihael.Schmidt@xxxxxxxxxxx> wrote:

No, inline without static gives the same error messages.

https://github.com/fbuihuu/libtree/blob/master/rb.c

This is the source I try to compile.

Mihael

-----Original Message-----
From: c400-l-bounces+mihael.schmidt=rossmann.de@xxxxxxxxxxxx
[mailto:c400-l-bounces+mihael.schmidt=rossmann.de@xxxxxxxxxxxx] On
Behalf Of Erik Olsson
Sent: Tuesday, February 01, 2011 12:06 PM
To: C programming iSeries / AS400
Subject: Re: [C400-L] inline function

Does it work if you remove static?

2011/2/1 Schmidt, Mihael <Mihael.Schmidt@xxxxxxxxxxx>:
Hi,

I have some problems compiling a source with the following function:

static inline enum rb_color get_color(const struct rbtree_node *node)
{
       return node->color;
}

The error messages are:

CZM0166 : Definition of function inline requires parentheses.
...
CZM0485 : Parameter declaration list is incompatible with declarator
for inline.
...

If I remove inline everything compiles just fine.

Any idea?

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 is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.


--
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.

--
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.

--
Sent from my Galaxy tablet phone with with K-9 Mail. Please excuse my
brevity.
--
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.

--
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.