Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Can "enum" be forced to a certain "bitness"? Date: Wed, 09 Sep 2015 17:10:00 -0700 Organization: None to speak of Lines: 32 Message-ID: References: <87lhcgoh4j.fsf@bsb.me.uk> <2c4d7c17-8b7d-4ea2-aa7d-73d8de39eb49@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="15126"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+jKQsCR5rj132SbrU1wnj" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:OuG3DB10C6sMuNvhlRuafXJ0SA4= sha1:Wd9VRM1ZghP+2vnSoEh5c0fNgQM= Xref: csiph.com comp.lang.c:70100 Les Cargill writes: > Bartc wrote: [...] >> Why shouldn't it have a type? The following displays "4": >> >> enum {red,green} colour; >> >> printf("%d\n",sizeof(colour)); >> >> So it has a size, at least. > > It doesn't have a type *per se*. Of course it has a type. That type is the anonymous enumerated type created by `enum {red,green}`. The type is compatible with an implementation-defined integer type (which may or may not be int). Why do you think it doesn't have a type? > This is just 'C', where > "when in doubt, it's an int." That may be true, but only because there are no cases where there's any doubt (unless you can think of one). [...] -- 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"