Re: resolving a warning error
From: Dan Pop (Dan.Pop_at_cern.ch)
Date: 10/28/04
- Next message: Dan Pop: "Re: vulnerabilities"
- Previous message: Dan Pop: "Re: Is this legal stuff as per C Standard?"
- In reply to: michael potter: "resolving a warning error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Oct 2004 16:50:34 GMT
In <2379dacc.0410271530.531989ef@posting.google.com> pottmi@gmail.com (michael potter) writes:
>I would like to code a prototype that returns an enum, but not declare
>the enum.
>
>This works on several systems and compilers, but fails on aix xlc.
Not if you invoke them in conforming mode:
fangorn:~/tmp 200> gcc test.c
fangorn:~/tmp 201> icc test.c
fangorn:~/tmp 202> gcc -ansi -pedantic test.c
test.c: In function `main':
test.c:8: warning: ISO C forbids forward references to `enum' types
fangorn:~/tmp 203> icc -Xc test.c
test.c(8): warning #102: forward declaration of enum type is nonstandard
enum anEnum someFunc(void);
^
The diagnostic is *required* by the C standard:
6.7.2.3 Tags
Constraints
1 A specific type shall have its content defined at most once.
2 A type specifier of the form
enum identifier
without an enumerator list shall only appear after the type it
specifies is complete.
>How can I eliminate that warning message without eliminating other
>warning messages and without declaring the enum?
Your only chance is to find a way of invoking xlc in nonconforming mode,
because a conforming compiler MUST generate it, but you *really* don't
want to do that.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Dan.Pop@ifh.de
Currently looking for a job in the European Union
- Next message: Dan Pop: "Re: vulnerabilities"
- Previous message: Dan Pop: "Re: Is this legal stuff as per C Standard?"
- In reply to: michael potter: "resolving a warning error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|