[gtk-list] Re: [sad ale org: gtk compile error on HP-UX]
- From: Tor Lillqvist <tml hemuli tte vtt fi>
- To: gtk-list redhat com
- Subject: [gtk-list] Re: [firstname.lastname@example.org: gtk compile error on HP-UX]
- Date: Mon, 5 Oct 1998 11:19:26 +0300 (EETDST)
Alan Shutko writes:
> Right. I remember this. The problem is that
> #define GTK_CTREE_NODE_NEXT(_nnode_) ((GtkCTreeNode *)(((GList
> It is technically illegal in ANSI C to put casts on the left side of
> an =. (That is, casts do not create an lvalue. ISO/IEC 9899:1990
> S6.3.4.) Most compilers allow this to work, but not HPUX's.
> Unfortunately, these casts seemed pretty common back when I looked at
> things and I don't know a good way to fix the above. That's when I
> gave up. (I was subsequently moved to DUX, which works fine.)
The easiest way is to define two macros, one that doesn't cast to
GtkCTreeNode * and one that does.
#define GTK_CTREE_NODE_NEXT_(_nnode_) (((GList *)(_nnode_))->next)
#define GTK_CTREE_NODE_NEXT(_nnode_) ((GtkCTreeNode *)(GTK_CTREE_NODE_NEXT_(_nnode_)))
Then use the GTK_CTREE_NODE_NEXT_ macro in the left sides of assignments.
(This was from memory, I don't have my gtk+ source tree used on HP-UX
available right now, so there might be some minor details wrong, but
you get the idea.)
] [Thread Prev