> +#define SET_STRIDED (_usage, _name) \
> +case _usage: \
> +strided->u.s._name.lpData = data; \
> +strided->u.s._name.dwType = element->Type; \
> +strided->u.s._name.dwStride = stride; \
> +break;
> +
> +#define SET_STRIDED_(_usage, _name) \
> +case _usage: \
> +strided->u.s._name.lpData = data; \
> +strided->u.s._name.dwType = element->Type; \
> +strided->u.s._name.dwStride = stride; \
This is pretty ugly: the resulting code doesn't look like C.
In fact, it looks rather magical.For example, why pass in _usage
as a param to the macro, just to get rid of the
case _usage:
which you actually want outside the macro for readability.
Also, accessing the magic strided, data, element, stride
directly is very weird, and problematic. The casual user
wouldn't know what hit him :)
I say let it be as is. If you really want the macro, something
like this would be better:
+#define SET_STRIDED_(_strided, _name, _data, _element, _stride) \
+_strided->u.s._name.lpData = _data; \
+_strided->u.s._name.dwType = _element->Type; \
+_strided->u.s._name.dwStride = _stride;
--
Dimi Paun <dimi(a)lattica.com>
Lattica, Inc.