|
From: | Andreas Färber |
Subject: | Re: [Qemu-devel] [PATCH v4 4/8] Use libuuid if available. |
Date: | Mon, 1 Sep 2008 18:32:55 +0200 |
Am 01.09.2008 um 17:30 schrieb Jamie Lokier:
Andreas Färber wrote:+static int generate_uuid;Does C99 ensure that generate_uuid gets initialized to zero? Afaik in ANSI C it was undefined and needed an explicit assignment.This is wrong. In ANSI C (C89) and K&R before it, it is initialised to zero: http://c-faq.com/decl/initval.html You might have seen compiler environments where the explicit assignment is needed. They certainly exist, on some 'embedded' things like set-top boxes. They are not standard C, but a useful variant.
Thanks to all of you for the answers. I wasn't aware there was a difference between global/static and non-static local variables in that aspect. The latter are not guaranteed to be initialized to zero, according to the link.
(Jamie: We had used MSP430 based sensor nodes in our C lecture back then.)
Andreas
[Prev in Thread] | Current Thread | [Next in Thread] |