Initializing arrays of char
Flint Pellett
flint at gistdev.gist.com
Tue Oct 23 04:32:57 AEST 1990
scs at adam.mit.edu (Steve Summit) writes:
>Sorry to be unsympathetic, but if a system can be brought to its
>knees by a user program grabbing all available swap space and/or
>cpu cycles, then that's the bug, pure and simple.
You won't get any argument from me on that: you're right. (The
configuration in which this occurred happened to be the default
unmodified configuration right from the vendor: after it happened
I told them the same thing you just said, but not as politely.)
>Should "features" such as
> while(1); /* don't try */
>or
> while(malloc(1) != NULL); /* these at */
>or
> while(fork() >= 0); /* home, kids */
>be disallowed for the same reason?
Obviously not. They are different from the thing being discussed,
because in the above, everything that is happening is EXPLICIT.
That's my whole argument, that I dislike to see things happening
IMPLICITLY, or inconsistently, which is clearly what is going on when
char a[2] = "a"; does add a '\0' and char a[2] = "ab"; does not.
That's why I like Karl's idea of adding the \c : because it makes
everything that is happening very explicit, so you don't miss it.
Have we beaten this to death yet?
--
Flint Pellett, Global Information Systems Technology, Inc.
1800 Woodfield Drive, Savoy, IL 61874 (217) 352-1165
uunet!gistdev!flint or flint at gistdev.gist.com
More information about the Comp.lang.c
mailing list