Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: sizeof a struc field Message-ID: <11263@smoke.BRL.MIL> Date: 12 Oct 89 01:51:08 GMT References: <7710@microsoft.UUCP> <11086@smoke.BRL.MIL> <131@dtoa3.dt.navy.mil> <11227@smoke.BRL.MIL> <7678@cdis-1.uucp> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 16 In article <7678@cdis-1.uucp> tanner@cdis-1.uucp (Dr. T. Andrews) writes: -In article <11227@smoke.BRL.MIL>, gwyn@smoke.BRL.MIL (Doug Gwyn) writes: -)) ... WHY (((type *)0)->anything) is disallowed in the context -)) of compile-time expressions. -) Because (type *)0 is SYNTACTICALLY a null pointer, and there is a -) prohibition against using a null pointer as the left operand of ->. -It is begging the question to say that "it is disallowed because it -is prohibited". The sizeof() operator is used to extract type -information, and the cited NULL pointer happens to come complete -with all of the required type information. No, there IS no type information, because the construct is officially meaningless. You THINK you know what type was MEANT, but the compiler is not obliged to mimic your thought processes. This is not an issue about sizeof, but rather about ->.