Re: Thou shalt have no other gods before the ANSI C standard
websnarf_at_gmail.com
Date: 02/08/05
- Next message: websnarf_at_gmail.com: "Re: Thou shalt have no other gods before the ANSI C standard"
- Previous message: Roger Schlafly: "Crypto Mini-FAQ"
- In reply to: D. J. Bernstein: "Thou shalt have no other gods before the ANSI C standard"
- Next in thread: Douglas A. Gwyn: "Re: Thou shalt have no other gods before the ANSI C standard"
- Reply: Douglas A. Gwyn: "Re: Thou shalt have no other gods before the ANSI C standard"
- Reply: Alan Balmer: "Re: Thou shalt have no other gods before the ANSI C standard"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 7 Feb 2005 18:47:59 -0800
D. J. Bernstein wrote:
> Douglas A. Gwyn wrote:
> > The fact is, using calloc to initialize non-integer values is
> > *wrong*
> [...]
> I'll readily agree that the all-0-bytes representation of NULL isn't
> guaranteed by the C standard. I'll also agree that there was, once
> upon a time, an obscure C implementation that, for silly reasons,
> used a different representation of NULL.
Oh its worse than that -- there apparently exists exactly 2 platforms
which could use two different representations for a pointer depending
on their type. Because of these two platforms (neither of which has a
C99 compliant compiler installed on them -- and which never will) the
standard says you can't memcpy pointers, or assume the size of one is
the same as the size of another, etc.
> [...] But this doesn't mean that programs relying on the all-0-bytes
> representation are ``wrong.'' It simply means that they won't work
> with goofy implementations of C.
>
> > and every competent C programmer knows it
Do you like how he snuck in "competent" in there? He actually tried to
defend '\0' terminated strings as actually *higher performance* than
length delimited strings. Sorry, but I don't associate competence with
that sort of stupidity/denial.
> The vast majority of C programmers are writing code for PCs,
> Macs, Suns, etc., running Windows, Linux, MacOS, BSD, etc., all
> of which guarantee
>
> * an all-0-bytes representation of NULL,
> * 8-bit char,
> * 16-bit short,
> * 32-bit int (the 286 is dead), and
> * IEEE single-precision 32-bit float (UNICOS is dead),
You left out a really important one: right shifting of signed values
always results in sign extension. :) But seriously, you can't leave
2s complement off that list.
> among other things. Taking advantage of these guarantees is
> convenient for the programmer and doesn't sacrifice any real-world
> portability.
It is physically impossible for some people to parse and comprehend
that statement. I'm not kidding, the very concept of what you just
said is just far too abstract of an idea for these people to
understand. It is beyond their being.
2s complement, IEEE-754, 32bit ints is a defacto standard that has more
momentum than any language specification. That's why these important
functional attributes continue to exist even though the latest ISO C99
standard (which is 4+ years old now) has not been adopted by any major
vendor. The deafening silence with which the C99 standard has been met
by the industry is testimony to what the *REAL* standard is (POSIX +
the various system ABIs + the "32bit" features you listed above).
-- Paul Hsieh http://www.pobox.com/~qed/ http://bstring.sf.net/
- Next message: websnarf_at_gmail.com: "Re: Thou shalt have no other gods before the ANSI C standard"
- Previous message: Roger Schlafly: "Crypto Mini-FAQ"
- In reply to: D. J. Bernstein: "Thou shalt have no other gods before the ANSI C standard"
- Next in thread: Douglas A. Gwyn: "Re: Thou shalt have no other gods before the ANSI C standard"
- Reply: Douglas A. Gwyn: "Re: Thou shalt have no other gods before the ANSI C standard"
- Reply: Alan Balmer: "Re: Thou shalt have no other gods before the ANSI C standard"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|