Matthew Dempsky <matt...@dempsky.org> writes:

> On Mon, May 5, 2014 at 3:56 PM, Alexander Hall <alexan...@beard.se> wrote:
>> I believe a similar situation could appear with not explicitly initialized
>> global or static declarations, e.g. in
>> sbin/fsirand/fsirand.c:
>>
>> fsirand(char *device)
>> {
>>         ...
>>         static char *inodebuf;
>
> This is safe too: C requires that pointer variables with static
> storage duration like this be initialized to a null pointer (C99
> section 6.7.8 paragraph 10), not to a sequence of 0 bytes.

People often ask where to find this kind of information, but the
C99 standard[1] is actually available free of charge, same for C11[2].
I also like to point them at the C FAQ[3].

[1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
[2] http://www.open-std.org/jtc1/sc22/wg14/www/standards.html
[3] http://c-faq.com/
-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to