[9051] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Re: [sad@ale.org: gtk compile error on HP-UX]

daemon@ATHENA.MIT.EDU (Tor Lillqvist)
Mon Oct 5 04:19:37 1998

From: Tor Lillqvist <tml@hemuli.tte.vtt.fi>
Date: Mon, 5 Oct 1998 11:19:26 +0300 (EETDST)
To: gtk-list@redhat.com
In-Reply-To: <m3emsqddy9.fsf@hubert.wuh.wustl.edu>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com

Alan Shutko writes:
 > Right.  I remember this.  The problem is that 
 > 
 > #define GTK_CTREE_NODE_NEXT(_nnode_) ((GtkCTreeNode *)(((GList
 >  *)(_nnode_))->next))
 > 
 > 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.)

--tml

-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post