Path: utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!SUN.COM!frame!troy!drf From: frame!troy!drf@SUN.COM (David Fuchs) Newsgroups: gnu.gcc.bug Subject: address constant bug? Message-ID: <8810160118.AA00879@troy.frame.com> Date: 16 Oct 88 01:18:08 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 18 The following program causes a compile-time error message from gnu-cc version 1.29. K&R 2nd ed., A7.19 seems to imply that it should be OK. -David Fuchs ( sun!frame!drf or "frame!drf"@sun.com ) /* A wonderful macro for finding the byte-offset of a field in a struct: */ #define OFFSET(type,field) ((int)&((type *)0)->field) typedef struct { int i; short s[100]; } foo; int offsets[] = { OFFSET(foo, i), OFFSET(foo, s), /* This works ok, but the next line results in... */ OFFSET(foo, s[0]), /* "initializer for static variable is not constant" */ 0 };