[GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raster/r.neighbors raster/r.out.bin raster/r.quant raster/r.resamp.filter raster/r.series raster/r.series.accumulate raster/r.series.interp raster/r.stats.quantile vector/v.colors vector/v.external.out
Huidae Cho
grass4u at gmail.com
Wed Jun 11 07:12:47 PDT 2014
Right, G_option_exclusive(void *first, ...) should work.
On Wed, Jun 11, 2014 at 6:43 AM, Glynn Clements <glynn at gclements.plus.com>
wrote:
>
> Huidae Cho wrote:
>
> > Maybe, we can use variadic macros in C99 to remove the first name
> argument.
>
> GRASS doesn't require C99. In general, we try to keep the hard
> dependencies to a bare minimium, particularly in core functionality
> such as libgis.
>
> In any case, the <stdarg.h> requirement for an explicit first argument
> isn't a significant problem. The functions would never be called with
> less than two arguments.
>
> In the worst case, it complicates the implementation slightly, as we
> can't simply iterate over all of the arguments using va_arg(), but
> have to treat the explicit argument separately. That can be handled
> like:
>
> void G_option_exclusive(void *first, ...)
> {
> void *opt = first;
> va_start(ap, first);
> for (;;) {
> process(opt); // search for opt in options/flags
> opt = va_arg(ap, void*);
> if (!opt) // NULL terminator
> break;
> }
> va_end(ap);
> }
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20140611/ce105658/attachment.html>
More information about the grass-dev
mailing list