Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 12 Jan 2013 01:07:46 -0600
From: Bobby Bingham <>
Subject: Re: NULL

On Sat, Jan 12, 2013 at 12:56 AM, Rob Landley <> 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

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.