[Mesa-dev] Merging gallium-rect-textures and debug-refcnt?
luca at luca-barbieri.com
Fri Aug 20 05:09:16 PDT 2010
> The advantage of having a prefix is that it makes it easy to detect when
> people don't include the proper headers such as u_string.h, and it
> guarantees one can wrap around even buggy OS implementations without
> doing #define magic. It also allows to easily add wrapping.
It is indeed possibly advantageous if the platform provides a broken
implementation, but as you point out #define magic can solve this, and
I expect/hope this to be a rare exception.
A price for this is however paid by everyone all over the codebase,
while the #define magic (or any other magic) would be localized.
The best approach would probably be to decide this on a case-by-case
basis, and in some cases I'd argue that the current state is obviously
not the right choice:
1. INLINE is very frequently used, and defining "inline" instead is
actually simpler, and is less confusing for source
2. "memcmp" is currently OK, but one is supposed to use "util_strcmp"
instead of "strcmp", which looks quite hard to remember and get right
BTW, MSDN documents strcmp to be available at least in user mode and
u_string.h provides his own implementation anyway.
Did Microsoft actually manage to somehow provide a broken strcmp?
If not, then the system implementation is likely to be much faster due
to target-specific optimizations.
More information about the mesa-dev