Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #127877
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <kst-u@mib.org> |
| 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 | <ln605x8de7.fsf@kst-u.example.com> (permalink) |
| References | <a%iqC.2508$%a5.2417@fx21.am4> <lna7va88bg.fsf@kst-u.example.com> <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 |
Show key headers only | View raw
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 <http://www.ghoti.net/~kst>
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"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar
enums in structs bartc <bc@freeuk.com> - 2018-03-15 00:20 +0000
Re: enums in structs Keith Thompson <kst-u@mib.org> - 2018-03-14 17:57 -0700
Re: enums in structs supercat@casperkitty.com - 2018-03-14 20:04 -0700
Re: enums in structs Keith Thompson <kst-u@mib.org> - 2018-03-15 10:19 -0700
Re: enums in structs Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-14 20:07 -0700
Re: enums in structs David Brown <david.brown@hesbynett.no> - 2018-03-15 11:36 +0100
Re: enums in structs Thiago Adams <thiago.adams@gmail.com> - 2018-03-15 05:33 -0700
Re: enums in structs "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-03-15 05:39 -0700
Re: enums in structs Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-15 06:35 -0700
Re: enums in structs jameskuyper@verizon.net - 2018-03-15 06:26 -0700
csiph-web