Re: [PATCH] Trivial warning fix for imap-send.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mark Wooding wrote:
Linus Torvalds <torvalds@xxxxxxxx> wrote:

So in modern C, using NULL at the end of a varargs array as a pointer is perfectly sane, and the extra cast is just ugly and bowing to bad programming practices and makes no sense to anybody who never saw the horror that is K&R.

No!  You can still get bitten.  You're lucky that on common platforms
all pointers look the same, but if you find one where `char *' (and
hence `void *') isn't the same as `struct foo *' then, under appropriate
circumstances you /will/ unless you put the casts in.

Please explain how malloc() can work on such a platform. My reading of the '89 ANSI C spec. finds that _ALL_ (non function) pointers _are_ cast-able to/from a void * and that NULL should be #defined as (void *). See 3.2.2.3 and 4.1.5 if interested.
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]