|
|
Subscribe / Log in / New account

Who maintains dpkg?

Who maintains dpkg?

Posted Mar 18, 2008 21:08 UTC (Tue) by wblew (subscriber, #39088)
In reply to: Who maintains dpkg? by dw
Parent article: Who maintains dpkg?

The C language standard specifies that the constant 0 in the context of a given pointer type
is taken to mean the null value for that pointer type.

As a result the notion of a universal NULL was brain damage right from the start. The fact
that the K&R book uses the NULL notation is no excuse to tolerate that brain damage in
perpetuity.

As a personal guideline, I consider it cleaner and more correct to just use 0 instead of NULL
or whatever. If nothing else you avoid a conversion from T* to void* and in some contexts that
might involve a runtime cost and/or have other effects.

I prefer this commonly used idiom:

char *p = /* some value */
if (p)      /* p is not the null pointer, just like p!=0, but shorter */
if (!p)     /* p is the null pointer, just like p==0, but shorter */

All style discussions aside, two points:

1) The GPLv2 speaks very clearly on the parties' rights. As a receiver of a GPLv2 licensed
software work, I have the *same* rights to change that work as the original author, so long as
I retain that work's GPLv2 license.

I do not have to ask "permission" of that original author to modify and then distribute his
work in that modified form. What moral rights? Hogwash...

2) When somebody is using "moral arguments" in a technical context its time to *carefully*
analyze their arguments. IMO it usually comes down to this: I don't like what you are doing,
but I have no technical or legal basis for my opinion, so I am invoking my moral rights in
this matter.

PS: IMO they are both wrong on the merits, I'd use 0, and not NULL, nor (char*)0. That is
because the compiler already considers 0 to be the null value for the pointer type "char*".

No casts needed, cruft is cruft, making it harder to grok.

cheers,


to post comments

Who maintains dpkg?

Posted Mar 18, 2008 21:35 UTC (Tue) by mgb (guest, #3226) [Link]

"I'd use 0".  Which would be a bug.

We're talking about a varargs function.  The compiler does not know to convert 0 to (char *)0.
This is a bug in many architectures, including the once-popular i386 "compact" and "medium"
memory models.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds