[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
0 vs. NULL vs. '\0'
From: |
Karl Berry |
Subject: |
0 vs. NULL vs. '\0' |
Date: |
Mon, 5 May 2014 23:56:17 GMT |
It's a question of style and personal preference.
Yes, I am aware :). I think "NULL" is consistently used as the null
pointer in the rest of the code. (And I think it's clearer that way.)
It was in all the code I worked on, anyway.
NULL being #defined is a non-issue; everything #includes so many files
it is always defined. (It's guaranteed to be defined from <stdio.h>,
and others.)
(BTW, it's also allowed to be #defined to ((void *)0), last I knew,
although it makes no practical difference.)
I don't think '\0' has been consistently used for the null character
byte, although of course it's perfectly reasonable to do. I tended to
write just 0 for that :). Anyway ...
k
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 0 vs. NULL vs. '\0',
Karl Berry <=