× 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.



Yes. It is a macro. I am not well versed in C.

For understanding my needs you would have to read the README at https://github.com/fbuihuu/libtree

I have to create a compare function as a callback function in RPG (as RPG in my main programming language). The callback function gets two nodes. Each node is embedded in a user defined data structure. The function calculates the beginning of the user defined data structure by using the embedded node, some sizes and the offsetof macro. Actually I don't know how this works as I have seen it the first time today. But somehow it 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 Dennis
Sent: Tuesday, February 01, 2011 4:17 PM
To: C programming iSeries / AS400
Subject: Re: [C400-L] inline function

From my understanding, rbtree_container_of is a macro rather than a function (although it may seem to share some function attributes). In what way would you hope to use rbtree_container_of in an RPG program/module?

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

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.

--
Sent from my Galaxy tablet phone with with K-9 Mail. Please excuse my brevity.

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.