Handling of untagged structures by the C compiler

Karl Heuer karl at haddock.ima.isc.com
Sat Sep 22 10:33:32 AEST 1990


In article <879 at gtenmc.UUCP> ravim at gtenmc.UUCP (Ravi Kumar Mandava) writes:
>	#define ST struct { int i; }
>[lost of stuff refering to `ST *']
>Why can't the compilers be made more intelligent so as to recognize the
>equivalence of structure types with the same definitions...?

I have a struct complex, which consists of two numbers, and a struct vec2d,
which consists of two numbers.  They are logically distinct types, and I want
the compiler to complain if I mix them.  Your proposal would prevent this.

A better idea is to educate the user to quit doing that nonsense.  There's no
good reason for that symbol to be a macro instead of a typedef.

Karl W. Z. Heuer (karl at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint



More information about the Comp.lang.c mailing list