Allowing the use of // for comments would be really useful as VS has a handy 
button for commenting out selected code and it prefixes each line with //



From: [email protected] 
[mailto:[email protected]] On Behalf Of Graham Bloice
Sent: 02 September 2016 08:54
To: Developer support list for Wireshark <[email protected]>
Subject: Re: [Wireshark-dev] Allowing use of more C99 features



On 2 September 2016 at 03:51, Guy Harris 
<[email protected]<mailto:[email protected]>> wrote:
On Sep 1, 2016, at 1:14 PM, Peter Wu 
<[email protected]<mailto:[email protected]>> wrote:

> Patch https://code.wireshark.org/review/17421 will allow use of some C99
> features in master (future 2.4):

For UN*X, with autotools:

        The AC_PROG_CC_C99 macro is used, and, if it fails to enable what it 
considers "C99 mode" for the compiler, the configure script will fail.  This 
means some older compilers may not be supported; it's probably time to drop 
those compilers.  The macro appears to try to enable it for:

                GCC (and Clang), using -std=gnu99
                IBM XL C, using -qlanglvl=extc99
                HP cc, using -AC99
                Intel ICC, using -std=c99
                SGI's C compiler for IRIX, using -c99
                Sun/Oracle's C compiler, using -xc99=all
                DEC/Compaq/HP's C compiler for Alpha on Tru64, using -c99

        so you're out of luck if you have a version of those compilers that 
doesn't support those flags and doesn't support all of:

                _Bool, // comments, flexible array members, inline, signed and 
unsigned long long int, mixed code and declarations, named initialization of 
structs, restrict, va_copy, varargs macros, variable declarations in for loops, 
and variable length arrays

For UN*X, with CMake:

        I'm not sure whether it'll properly enable C99 support for all of the 
compilers in question.

For Windows (CMake assumed), MSVC 2013 supports:

        // comments as long as you don't compile with /Za, but there might be a 
warning to suppress;

        flexible arrays, but there's a warning to suppress, which this change 
suppresses;

        inline functions - it might require __inline rather than inline, but 
GLib is #defining inline to be __inline with MSVC, so we can just use "inline";

        mixed code and declarations, but there's a bug that might or might not 
hit us:

                
https://connect.microsoft.com/VisualStudio/feedback/details/808650/visual-studio-2013-c99-compiler-bug

That particular example seems to have been fixed, at least for me with VS2013 
Update 5.

        named initialization of structs, but there's a bug that might or might 
not hit us:

                
https://connect.microsoft.com/VisualStudio/feedback/details/805981

That particular example seems to have been fixed, at least for me with VS2013 
Update 5.



        varargs macros, which we're already using;

        variable declarations in for loops, apparently:

                
http://stackoverflow.com/questions/21696983/error-on-declaring-variable-in-for-statement

so, in addition to

> - flexible array members
> - trailing comma in enum declarations
> - inline function keyword

we also can use // comments and, apparently, variable declarations in for 
loops, assuming there's no bug that gets in the way.  *If* we avoid the bugs, 
we can also use mixed code and declarations and named initialization of structs.



--
Graham Bloice

______________________________________________________________________

This message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system.

Any views or opinions expressed are solely those of the author and do not 
necessarily represent those of Advance Seven Ltd. E-mail transmission cannot be 
guaranteed to be secure or error-free as information could be intercepted, 
corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The 
sender therefore does not accept liability for any errors or omissions in the 
contents of this message, which arise as a result of e-mail transmission.

Advance Seven Ltd. Registered in England & Wales numbered 2373877 at Endeavour 
House, Coopers End Lane, Stansted, Essex CM24 1SJ

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:[email protected]?subject=unsubscribe

Reply via email to