Liste des Groupes | Revenir à cl c |
Michael S <already5chosen@yahoo.com> writes:
On Mon, 8 Jul 2024 15:23:47 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> wrote:
On 7/8/2024 12:28 PM, Michael S wrote:>
On Sun, 07 Jul 2024 15:17:34 -0700>
Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
I just about always use NULL, not 0, when I want a null pointer>
constant. Similarly, I use '\0', not 0, when I want a null
character, 0.0 when I want a floating-point zero, and false when
I want a Boolean zero. I just like being explicit.
Pointer: I very rarely use NULL.
Character: I never use '\0'.
Not even something like:
>
#define CLINE 128
>
char x[CLINE] = { '\0' };
>
?
>
;^)
I see nothing special about your case. {0} is the most appropriate.
Any use of '\0' almost always strikes me as an affectation. It's
like people want to somehow pretend that it's not the same as
just 0.
And, BTW, I never use #define for integer constants.
What do you do if you need to define a compile-time constant
whose value is outside the range of signed int? With the
understanding that the context is C as it is now, and not
C++ or some imagined other language.
Les messages affichés proviennent d'usenet.