Re: Update coding standards wrt. C99?
| From: | G. P. B. | Date: | Wed, 06 May 2020 10:52:26 +0000 |
| Subject: | Re: Update coding standards wrt. C99? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-110037@lists.php.net to get a copy of this message | ||
On Wed, 6 May 2020 at 12:20, Xinchen Hui <laruence@php.net> wrote:
> mixing declarations and codes sometimes brings unexpected
> varaibles overriden and hard to debugging.
>
> thanks
>
> --
> Xinchen Hui
> @Laruence
> http://www.laruence.com/
In a perfect world we would be able to enable the -Wshadow GCC
compiler warning which would shout when such bugs could pop out,
however variable shadowing is pretty common in the engine, and
unless someone knows a way to "baseline" the current warnings such
that only new/refactored code warns it seems like a long shot to get
to a state where we can do that.
Another related concern may be that a variable is not yet initialized,
which can be flagged using -W-jump-misses-init, however due to a
couple of limitations enabling it is not feasible without some small
compromises, see https://github.com/php/php-src/pull/5389
Best regards
George P. Banyard