[GRASS-dev] Are such construction/declaration allowed for GRASS ??

Jarek Jasiewicz jarekj at amu.edu.pl
Sat Mar 13 05:40:20 EST 2010


Glynn Clements pisze:
> Jarosław Jasiewicz wrote:
>
>   
>> Can I use in module prepared for GRASS such constructions:
>>
>> typedef enum {
>>     AND,        /* & */
>>     OR,            /* | */
>>     NOT,        /* ~ */
>>     IS,            /* = */
>>     THEN,        /* : */
>>     LBRC,        /* ( */
>>     RBRC,        /* ) */
>>     START,    /* { */
>>     STOP,        /* } */
>>     MAP,        /* mapname */
>>     VAR,        /* variable name */
>>     size        /* number of tokens */
>> } tokens;
>>
>> char parseTab [size][size] = { /* parser table definition is here */
>>     };
>>
>> I mean type enum and enum size variable to initialize table. It compiles 
>> on gcc 4.3 but, as I know GRASS has restriction and I'm not sure if such 
>> is fully allowed.
>>     
>
> In general, if it's valid C89 (use "gcc -std=c89 ..." to check), then
> it's fine. Any use of gcc extensions or C99-specific features must be
> conditional, with a fallback if those features aren't available. 
> Similarly, use of functions which aren't specified by C89 should be
> conditionalised (non-C89 functions which are specified by POSIX are
> okay provided that they're available on Linux, Windows and MacOSX).
>
>   
Ok, thanks Glynn. It means I shoud be OK, but I didn't find typedef enum 
... in any fo GRASS code, so I asked.
Jarek.


More information about the grass-dev mailing list