Re: [dwm] malloc'ed client in manage()

From: Szabolcs Nagy <nszabolcs_AT_gmail.com>
Date: Sun, 7 Sep 2008 16:24:50 +0200

On 9/7/08, Nicolas Martyanoff <khaelin_AT_gmail.com> wrote:
> If NULL expands to 0, then basic logic tells me that the null pointer
> constant is 0; if I'm making a logic error, what is it ?

you expect that the symbol '0' means the same for integers and
pointers, but it's not

(as i wrote earlier: integer 0 is 'all-bits-zero', thus memset works,
but pointer 0 is not required to be 'all-bits-zero', it just *happens
to be* 'all-bits-zero' on every sane platform)

> The standard contains ambiguities, everybody knows that; if K&R 2 tells

no the standard is very precise about this.

> struct foo bar;
> memset(&bar, 0, sizeof(struct foo));
>
> Will get bar.i == 0, and foo.ptr == NULL.

not guaranteed by the standard
Received on Sun Sep 07 2008 - 14:24:50 UTC

This archive was generated by hypermail 2.2.0 : Sun Sep 07 2008 - 14:36:04 UTC