Turn on error on mixed declarations (Was: New extension proposal: meta)
| From: | Gustavo Lopes | Date: | Sun, 04 Sep 2011 03:28:47 +0000 |
| Subject: | Turn on error on mixed declarations (Was: New extension proposal: meta) | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-55165@lists.php.net to get a copy of this message | ||
On Sun, 04 Sep 2011 04:05:32 +0100, Kalle Sommer Nielsen <kalle@php.net> wrote:
2011/9/3 Arpad Ray <arraypad@gmail.com>:By the way, since committing code with mixed declarations is a frequent problem -- GCC accepts it even without -std=C99 yet the Windows builds are broken --, we could make GCC treat this as an error with: -Werror=declaration-after-statement which gives something like: foo.c:4:2: error: ISO C90 forbids mixed declarations and code -- Gustavo Lopes- Variable declarations should always begin a block, some platforms will bork otherwise.Actually this is required for the C standard, the early ones that we use in PHP, whereas C++ allows them anywhere in a block, like PHP does :)