Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!agate!bionet!apple!bloom-beacon!tut.cis.ohio-state.edu!mailrus!ncar!tank!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: strange effects with enum types Message-ID: <14080@mimsy.UUCP> Date: 20 Oct 88 10:06:43 GMT References: <143@csaran.cs.tcd.ie> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 19 In article <143@csaran.cs.tcd.ie> phrrngtn@cs.tcd.ie (Paul Harrington) writes: [everything unnecessary for bug invocation deleted] >enum{a=1,b,c}choice; >void f(p) struct { enum{a=1,b=2,c=3}choice; }*p; { > printf("(f) a=%d,b=%d,c=%d\n",a,b,c); } >main() { printf("(main) a=%d,b=%d,c=%d\n",a,b,c); f(); } [prints (main) a=1,b=2,c=3 (f) a=2,b=3,c=4 ] >why does the compiler ... produce this result and is it a bug of this >compiler or a "feature" of C ? The compiler is trying to be clever, and goofing. See my fix in comp.bugs.4bsd. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris