Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Handling of untagged structures by the C compiler Keywords: structures, equivalence, tagged, typecast Message-ID: <18104@haddock.ima.isc.com> Date: 22 Sep 90 00:33:32 GMT References: <879@gtenmc.UUCP> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Distribution: na Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 14 In article <879@gtenmc.UUCP> ravim@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@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint