Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.lang.c Subject: Re: The Dangers of sizeof Keywords: sizeof Message-ID: <2273@kappl.cs.vu.nl> Date: 10 Apr 89 18:17:08 GMT References: <9969@smoke.BRL.MIL> <3.UUL1.3#5109@pantor.UUCP> <105@servio.UUCP> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 29 penneyj@servio.UUCP (D. Jason Penney) writes: \... \I must disagree! There is only ONE form of sizeof -- the operator form, \which takes an arbitrary (unevaluated) expression as its argument. K&R seem to disagree. \... Trick question: what is the value of: \ \sizeof (char) - 1 \ \Answer: 1 -- the (char) is a cast, which is of higher precedence than \sizeof, [...] sizeof and casts have equal precedence. % cat c.c main() { printf("%d\n", sizeof(char) - 1); } % a.out 0 % People, please CHECK things before posting. -- "If it isn't aesthetically pleasing, |Maarten Litmaath @ VU Amsterdam: it's probably wrong." (jim@bilpin). |maart@cs.vu.nl, mcvax!botter!maart