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 <gl...@gclements.plus.com>
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to