[GRASS-dev] Are such construction/declaration allowed for GRASS ??
Glynn Clements
glynn at gclements.plus.com
Fri Mar 12 22:17:44 EST 2010
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).
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list