[GRASS-dev] C and C++ standards used by GRASS
Glynn Clements
glynn at gclements.plus.com
Fri Mar 28 14:40:59 PDT 2014
Vaclav Petras wrote:
> which C and C++ standards we are using? And which we want to use? Do we
> even care? Since we can always fix it if somebody wants to build GRASS on
> some other compiler than relatively new GCC.
C code is supposed to conform to C89 and POSIX.
There are no standards for C++ code.
> For example, lib/gis build fails with gcc option -std=c89 [1] because of
> missing `hypot` buildin [2].
hypot() is specified by POSIX.
Using -std=c89 or -ansi will, by default, omit the POSIX extensions
from any headers which are specified by C89. To re-enable them, you
need something along the lines of:
-D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE -D_SVID_SOURCE
We already require POSIX for open() etc, so there isn't much point in
excluding POSIX functions which are declared in the C89 headers.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list