Re: man 3 switch

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

 



On Thu, 19 Nov 2009, Cameron Simpson wrote:

On 16Nov2009 10:54, Rick Stevens <ricks@xxxxxxxx> wrote:
| Another example is that a null pointer (or the value "NUL") is not
| necessarily zero, only that it is guaranteed to not point at any valid
| datum.

Actually, it requires it to behave like 0 in an arithmetic context.

More precisely, it's required to behave like 0 in a boolean context.
It's not allowed in any other arithmetic context.
1 + ptr is invalid if ptr is null.
1 + !!ptr is 1 if ptr is null.

But it _doesn't_ require it to be stored as a zero in the machine
memory. That's why I cringe whenever I see someone use calloc() or

--
Michael   hennebry@xxxxxxxxxxxxxxxxxxxxx
"Pessimist: The glass is half empty.
Optimist:   The glass is half full.
Engineer:   The glass is twice as big as it needs to be."

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux