Re: [PATCH 0/4] drop some "int x = x" hacks to silence gcc warnings

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Jeff King <peff@xxxxxxxx> writes:
>
>> Git code was my introduction to it, too, and I was led to believe it was
>> idiomatic, so I can't speak further on that. I think it was Junio who
>> introduced me to it, so maybe he can shed more light on the history.
>
> I think we picked the convention up from the kernel folks.  At least
> that is how I first met the construct.  The uninitialized_var(x)
> macro was (and still is) used to mark these "The compiler is too
> dumb to realize, but we know what we are doing" cases:
>
>     $ git grep '#define uninitialized_var' include/
>     include/linux/compiler-gcc.h:#define uninitialized_var(x) x = x
>     include/linux/compiler-intel.h:#define uninitialized_var(x) x
>
> but they recently had a discussion, e.g.
>
>     http://thread.gmane.org/gmane.linux.kernel.openipmi/1998/focus=1383705
>
> so...

While flipping the paragraphs around before sending the message out
I managed to lose the important one.  Here is roughly what I wrote:

    I am for dropping "= x" and leaving it uninitialized at the
    declaration site, or explicitly initializing it to some
    reasonable starting value (e.g. NULL if it is a pointer) and
    adding a comment to say that the initialization is to squelch
    compiler warnings.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]