Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!igor!rutabaga!mcuddy From: mcuddy@rutabaga.Rational.COM (Mike Cuddy) Newsgroups: comp.unix.aix Subject: C compiler incompatibility Summary: (int *) a = b; why is 'a' not a valid lvalue? Keywords: casting, XLC Message-ID: Date: 28 Dec 90 22:11:37 GMT Sender: news@Rational.COM Lines: 63 I'm writing macros to deal with linked lists. (circular) and I'm having a spot of trouble with xlc ( this works fine on a SUN!): ------- cut here ------- typedef struct cll_f { struct list *next; struct list *prev; } cll_t; struct foo { cll_t list; int a, b, c; /* ... more stuff ... */ }; #define CLL_FOREACH(head,p) \ for((cll_t *)(p) = (head)->list.next ; \ (p) != (head) ; (cll_t *)(p) = (p)->list.next) void traverse(list) struct foo *list; { struct foo *p; CLL_FOREACH(list,p) { /* ... output data ... */ } } ------ cut here ------- % cc foo.c 23 | for((cll_t *)(p) = (list)->list.next ; (p) != (list) ; (cll_t ........a..................................................b...... a - 1506-025: (S) Operand must be a modifiable lvalue. b - 1506-025: (S) Operand must be a modifiable lvalue. *)(p) = (p)->list.next) { ------ extracted from my xlc.cfg: ------- * standard c compiler aliased as cc cc: use = DEFLT crt = /lib/crt0.o mcrt = /lib/mcrt0.o gcrt = /lib/gcrt0.o libraries = -lc proflibs = -L/lib/profiled,-L/usr/lib/profiled options = -H512,-T512, -qlanglvl=extended, -qnoro * common definitions DEFLT: xlc = /usr/lpp/xlc/bin/xlcentry as = /bin/as ld = /bin/ld options = -D_IBMR2,-D_AIX,-bhalt:4 ldopt = "b:o:e:u:R:H:Y:Z:L:T:A:V:k:j:" --Mike Cuddy "...He's a UNIX hack and he's okay, he works all night and he sleeps all day..."