[Top][All Lists]

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

Re: error: jump skips variable initialization

From: Paul Eggert
Subject: Re: error: jump skips variable initialization
Date: Mon, 25 Jun 2018 01:06:21 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

Bruno Haible wrote:
Can someone answer this?

I expect the warning is there because of style reasons, not correctness reasons. That is, although it's natural when seeing this line:

   int x = 10;

to assume that X must always be initialized, this assumption is incorrect if a goto jumps over the declaration. As a style matter, perhaps some C programmers want a warning if their code violates this natural assumption.

That being said, the warning is not emitted if the program simply does this 

   int x; x = 10;

so it does seem a bit ridiculous to enable the warning, and it'd be fine with me if we removed it from manywarnings.

reply via email to

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