Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: A glitch regarding the usual malloc() idiom Date: Thu, 04 Aug 2016 14:02:18 -0700 Organization: None to speak of Lines: 31 Message-ID: References: <4cd22745-22ad-4ac7-bdba-39ffa1c75e13@googlegroups.com> <48bfec8e-1f8b-4a7d-9de9-2f4b203efa88@googlegroups.com> <29458e01-2a24-4ce7-b856-87988b674c15@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="28979"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1oyl4FxPUFARoCwPWgLr0" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:ozlD3ze7lnDwYxPnUJ4KQCUisBk= sha1:28Wi4UiuoK4VaVNAVs2q3DdoJlM= Xref: csiph.com comp.lang.c:91680 John Bode writes: [...] > With the sole exception of VLAs, sizeof doesn't evaluate its operand > *at all*: > > sizeof a[i] > > does not perform the subscript operation; > > sizeof a+b > > does not perform the addition; > > sizeof a&&b > > does not perform the logical AND operation. Perhaps a more striking example: sizeof printf("hello, world\n") doesn't print anything. It's equivalent to `sizeof (int)`, since int is printf's return type. [...] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"