What machines core dump on deref of NULL?
Martin Weitzel
martin at mwtech.UUCP
Wed Jun 27 09:27:33 AEST 1990
In article <2392 at aix.aix.kingston.ibm.com> rlc at aix.aix.kingston.ibm.com (Roger Collins) writes:
[some lines deleted]
>To give another example of this situation, almost all UNIX systems
>initialize .bss to zero. This causes uninitialized global and static
>variables to be initialized to zero by default. Many, many programs,
>including System V commands, depend on this fact. They assume
>uninitialized global and static variables are initialized to zero
>even though the C language explicitly says the values are undetermined.
K&R1
Page 37:
External and static variables are initialized to zero
by default ...
Page 198:
Static and external variables which are not initialized are
guaranteed to start off as 0; ...
K&R2
Page 40:
External and static variables are initialized to zero
by default.
Page 219:
A static object that is not explicitly initialized is
initialized as if it (or its members) were assigned the
constant 0.
I don't have a copy of the ANSI-C-Standard handy, but I'm pretty
sure that it gives the same guarantee. Could you please name *one*
reference for the C language which supports your claim?
>This is wrong, I know.
Yes, of course it's wrong - but wouldn't it have been easier to
leave the last two sentences out? (Of course, this would have made
all the rest of the article pointless, so I guess the last sentence
doesn't apply to the claim, but to the fact that many programs
make the - perfectly correct - assumption that all uninitialized
data is initialized with zero.)
>Now, why don't you suggest to your boss that you release a computer
>that initializes .bss to 0xffffffff? (Leaving it uninitialized is a
>security hole on multiuser systems.) It doesn't break the C language.
Really? I'm pretty sure it breaks the C Language! Again: Please name
*one* reference for the C language that makes you think it wouldn't.
[rest deleted]
--
Martin Weitzel, email: martin at mwtech.UUCP, voice: 49-(0)6151-6 56 83
More information about the Comp.unix.wizards
mailing list