|
Message-ID: <CAFNaaxQKNXK0MDV1n73AGFQGR6VZkx-Lvk7NCEuMyzFeazEG1A@mail.gmail.com> Date: Sat, 12 Jan 2013 01:07:46 -0600 From: Bobby Bingham <uhmmmm@...il.com> To: musl@...ts.openwall.com Subject: Re: NULL On Sat, Jan 12, 2013 at 12:56 AM, Rob Landley <rob@...dley.net> wrote: >> int null_is_ptr_type() >> { >> char s[1][1+(int)NULL]; >> int i = 0; >> return sizeof s[i++], i; >> } > > > (int)NULL is 0 according to C99 so the NULL in there has no effect. And > referring to "i++" and "i" in the same statement is explicitly undefined > behavior (comma is not a sequence point, the compiler is free to evaluate > those in any order and different optimization flags _will_ change that > order; I got bit by that many moons ago). > >From c99 section 6.5.17 Comma operator: "The left operand of a comma operator is evaluated as a void expression; there is a sequence point after its evaluation. Then the right operand is evaluated; the result has its type and value" -- Bobby Bingham
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.