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

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

 




On Sun, 12 Mar 2006, 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.

Not relevant. Show me any system that matters.

The fact is, compilers should conform to programmers, not the other way 
around. Bending over backwards for broken systems is _wrong_. The fact 
that there are insane build environments doesn't excuse bad manners, and 
explicit casts that aren't needed are HORRIBLE manners.

There is no valid reason to _ever_ cast NULL pointers. 

Btw, the same goes for casting the result from malloc etc, which some 
people also do. 

Put another way: you should not encourage insane systems, and you should 
definitely NOT encourage nit-picking people who read the standards in 
insane ways and say that the standards _allow_ badly behaved build 
environments.

It's true that the standards _allow_ crazy build environments. Who the 
f*ck cares? Crazy and bad build environments aren't any better for being 
allowed by the standard. Screw them. Call them names. And refuse to work 
with them.

		Linus
-
: 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]