Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: enums in structs Date: Thu, 15 Mar 2018 10:19:44 -0700 Organization: None to speak of Lines: 20 Message-ID: References: <1af57651-5ef0-4ffd-95bd-4e73a2fbc4eb@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="4062d3804107f3b0a8439aa53526a52c"; logging-data="4354"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18kyeQee74lAEGhQBtejgSu" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:tFdBOcp95zr5au+/MGGZxKIxy4M= sha1:DHq0HKfxvQQsJ9QEs6Z2uqHyi7g= Xref: csiph.com comp.lang.c:127877 supercat@casperkitty.com writes: > On Wednesday, March 14, 2018 at 7:57:16 PM UTC-5, Keith Thompson wrote: >> If "red", "green", and "blue" had scopes restricted to the struct >> definition, you wouldn't be able to refer to their names outside the >> struct definition. C has no mechanism for prefixing an enumeration >> constant with the name of a type. > > You can't refer to their names outside the context of an object of the > appropriate structure type. Look back at the example (which you snipped, of course). "red", "green", and "blue" are enumeration constants, not member names. [SNIP] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"