Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

wrong struct member name

0 views
Skip to first unread message

migurus

unread,
Aug 28, 2009, 4:11:07 PM8/28/09
to
OSR 5.0.7 with SCO OpenServer Development System (ver 5.2.0Aa)

I had a typo in my code referring to a struct member which does not
belong to the struct being used, but that name exists in a different
struct. Compiler did produce .o file, - I would think this is a big
nistake, not a warning level problem.

See example below:
$ cat c.c
typedef struct {
int a;
} N1;
typedef struct {
int a;
int b;
} N2;
main(int argc, char *argv[])
{
N1 n1;
N2 n2;
n1.a = 1;
n1.b = 1;
n2.a = 1;
n2.b = 1;
}
$ cc -c c.c
UX:i386acomp: WARNING: "c.c", line 13: warning: improper member use: b


GNU compiler worked correctly:
$ gcc -c c.c
c.c: In function `main':
c.c:13: structure has no member named `b'

and no .o file created.

So, question is, does anybody know if there is a setting or flag for
the compiler to NOT produce .o file for the bug described?

0 new messages