Article View: gnu.gcc.help
Article #50345Re: generating warnings for non-enumatered enums
From: Marty Leisner x71348
Date: Sat, 09 Oct 1993 18:32
Date: Sat, 09 Oct 1993 18:32
40 lines
1844 bytes
1844 bytes
meissner@osf.ORG wrote:
: | Is there a warning to complain for this
: | program?
: |
: | there probably should be.
: |
: | int main()
: | {
: | enum { FOO=1, BAR=2 } blah;
: |
: | blah = 5;
: | return 0;
: | }
: |
: |
: | This is very useful if the compiler can detect when you don't use an
: | enum properly.
: Umm, given that the ANSI says that enumeration constants are just
: plain integers, the above program is correct and should not suffer
: warnings.
: --
Yes, it a correct program, which is the purpose of warnings...the ANSI spec
does not specify warnings, the implementer puts them in (rms?)
This is probably wrong, an a compiler should generate a warning when it
occurs...
Same goes true for arguments of enums...if you use something not enumerated,
the compiler should flag it as a potential error.
--
Marty Leisner leisner@eso.mc.xerox.com leisner.henr801c@xerox.com
The Feynman problem solving Algorithm
1) Write down the problem
2) Think real hard
3) Write down the answer
Murray Gell-mann in the NY Times
Technical Details
Message-ID:
<1993Oct9.183229.8444@spectrum.xerox.com>Path:
arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!darwin.sura.net!udel!rochester!rocksanne!hydrus!leisnerReferences:
meissner@osf.ORG <9310081505.AA01131@pasta.osf.org>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,fede4154eadbdd6f X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-10-09 17:15:06 PST Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!darwin.sura.net!udel!rochester!rocksanne!hydrus!leisner From: leisner@hydrus (Marty Leisner x71348 ) Subject: Re: generating warnings for non-enumatered enums Message-ID: <1993Oct9.183229.8444@spectrum.xerox.com> Sender: news@spectrum.xerox.com Reply-To: leisner@eso.mc.xerox.com Organization: Xerox X-Newsreader: TIN [version 1.2 PL0] References: meissner@osf.ORG <9310081505.AA01131@pasta.osf.org> Distribution: gnu Date: Sat, 9 Oct 1993 18:32:29 GMT Lines: 41