[exim-dev] C99 coding features

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Jeremy Harris
Datum:  
To: exim-dev@exim.org
Betreff: [exim-dev] C99 coding features
Since f2ed27cf5f (between 4.89 & 4.90) we've documented
a requirement on C99-capable compilers. This was the
introduction of specified-initialiser use in the Exim code.

How do people feel about other more-modern C features?

This was triggered by the Postgres hackers ML pointing out
that C99 permits variable declaration embedded in "for"
statements, eg:

    for (int i = 0; ...) { ... }



Ref:
       6.8.5  Iteration statements


       Syntax


               iteration-statement:
                       while ( expression ) statement
                       do statement while ( expression ) ;
                       for ( expr-opt ; expr-opt ; expr-opt ) statement
                       for ( declaration ; expr-opt ; expr-opt ) statement



I'm tempted by that one.

I severely dislike C++ - style one-line comments: code // comment.
I don't like mixing declarations with code.

Other possibilities mentioned include:
- variadic macros
- compound declarations: function((struct x) {1, 2})


Comments?
--
Cheers,
Jeremy