Re: [PATCH/RFC] reflog: silence -O3 -Wuninitialized warning
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Mar 16, 2011, 09:09 UTC
- Message-ID
- <4D807E66.40504@viscovery.net>
- In-Reply-To
- <7vfwqnabbi.fsf@alter.siamese.dyndns.org>
Am 3/16/2011 6:22, schrieb Junio C Hamano:
Show 7 quoted lines
> I am not suggesting to work this around on the caller side, but I wonder > what effect the usual workaround to tell the compiler that we know it > doesn't understand the validity of this variable by saying: > > unsigned long expire = expire; > > have on this?
Well, perhaps the compiler followed the C standard more closely than it is good? By the law, the assignment above provokes undefined behavior, and the compiler is allowed to do anything.
I think it's time that you accept patches that turn this into
unsigned long expire = 0;
-- Hannes