Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!ames!pacbell!att-ih!ihnp4!inuxc!iuvax!pur-ee!uiucdcs!bradley!bucc2!brian From: brian@bucc2.UUCP Newsgroups: comp.lang.c Subject: Re: 'BSD C compiler bug' Message-ID: <13100006@bucc2> Date: 23 Mar 88 09:35:00 GMT References: <570@mtxinu.UUCP> Lines: 41 Nf-ID: #R:mtxinu.UUCP:570:bucc2:13100006:000:1297 Nf-From: bucc2.UUCP!brian Mar 23 03:35:00 1988 > /* Written 7:55 pm Mar 18, 1988 by mtxinu.UUCP!tim in bucc2:comp.lang.c */ > /* ---------- "'BSD C compiler bug'" ---------- */ > Subject: BSD C compiler bug? > Newsgroups: comp.unix,comp.lang.c > Keywords: comma notation > > > There seems to be a bug with comma notation in BSD C. (It shows up > on the Ultrix, MORE/BSD and Sun compilers, FYI). > > This program: > 1 # define NULL 0 > 2 main() > 3 { > 4 unsigned char **foo; > 5 int fn(); > 6 > 7 foo = NULL; > 8 foo = (NULL, NULL); > 9 foo = ( !foo ? NULL : (fn(2), NULL) ); > 10 } > 11 > 12 fn(a) > 13 int a; > 14 { return (a); } > 15 > gets 'cc' errors: > "comma.c", line 8: warning: illegal combination of pointer and integer, op = > "comma.c", line 9: warning: illegal combination of pointer and integer, op = I _think_ changing those NULL's on lines 8,9 to (unsigned char **) NULL will eliminate these warnings. ............................................................................... When the going gets weird, the weird turn pro. Brian Michael Wendt UUCP: {cepu,ihnp4,uiucdcs,noao}!bradley!brian Bradley University ARPA: cepu!bradley!brian@seas.ucla.edu (309) 691-5175 ICBM: 40 40' N 89 34' W