Bug #65761 [Com]: comma at end of enumerator list
| From: | peterkokot at gmail dot com | Date: | Wed, 13 Jun 2018 21:57:25 +0000 |
| Subject: | Bug #65761 [Com]: comma at end of enumerator list | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-215707@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65761&edit=1
ID: 65761
Comment by: peterkokot at gmail dot com
Reported by: xuefer at gmail dot com
Summary: comma at end of enumerator list
Status: Open
Type: Bug
Package: Compile Warning
Operating System: Linux
PHP Version: 5.5.4
Block user comment: N
Private report: N
New Comment:
Hello, sorry for bumping this bug report after several years. The main issue is that currently there
isn't any coding style defined for the PHP source code where this would be agreed on - trailing
commas in enums or not.
This is so much more relevant to rethink if fixing this with the C99 standard at the door is
important today. With C99 in PHP the trailing commas will be legit unless agreed otherwise with the
coding style.
From what I'm currently reading, the LLVM coding style guide doesn't use them. Neither
does the default clang format tool enforce any particular trailing comma style. The Google C++ uses
trailing commas. Also the git differences can be a bit nicer.
The "trend" seems to me is going into trailing commas direction. Also, PHP has now
trailing commas available in functions, arrays etc :). I'd say to check out what is useful and
set it in the coding guide and/or define the clang format rule and stick to that in the PHP src code
base. Now, about fixing these C89 specific warnings or not... We can simply add a fix for this bug
report via pull request and define the particular code style for enums in the future if needed...
Previous Comments:
------------------------------------------------------------------------
[2013-09-25 17:19:49] xuefer at gmail dot com
Description:
------------
php/Zend/zend.h:283:15: warning: comma at end of enumerator list [-pedantic]
typedef enum {
SUCCESS = 0,
FAILURE = -1, <- line 283
} ZEND_RESULT_CODE;
This is not allowed in C89, but allowed in C99. yet not allowed in C++
I'm not sure if this is consider as a bug as PHP 5.5 is moving forward for new
compiler by dropping support to older ones. But it's better to fix it for building
extension that support multiple PHP versions
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65761&edit=1