C compiler incompatibility
Mike Cuddy
mcuddy at rutabaga.Rational.COM
Sat Dec 29 09:11:37 AEST 1990
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..."
More information about the Comp.unix.aix
mailing list