qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 4/8] Use libuuid if available.


From: Jamie Lokier
Subject: Re: [Qemu-devel] [PATCH v4 4/8] Use libuuid if available.
Date: Mon, 1 Sep 2008 16:30:01 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

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.

(This came up in a job interview for me once.  The interviewers
criticised a bit of my code for not having the initialiser, because
their embedded environment didn't initialise such variables.  The
reasons were good (device startup time), but it was annoying they
believed my code was wrong given they had asked a generic C question,
and didn't believe that their system and the C standard and widely
assumed behaviour didn't match.)

-- Jamie




reply via email to

[Prev in Thread] Current Thread [Next in Thread]