most compilers ignore the 'inline' keyword. if you're using gcc, 'static' functions are more likely to be inlined than inline functions.
Q2 used Cvar_Get throughout, with the result saved somewhere if performance was required. The primary advantage of doing so is that it then means renderers can consistantly get/register cvars independantly of each other/the engine, while with the Q1 aproach if its registered then its data must be at the given location.
(basically, cvar_get accepts name, default value, flags, etc, and returns a pointer to the cvar, if it doesn't already exist then its created, otherwise its merely returned, so Cvar_Find with register capability).
If you really need to, you can perform a binary search on cvar names or just use a hash table in order to accelerate your Cvar_Find functionality, but if you're doing it more than once per map, you're better off caching the address.
Try:
#define LOCALCVAR(n,d,f) static cvar_t *n; if (!n) n = Cvar_Get(#n, d, f)
float somerandomfunctionthatreturnssomevalue(void)
{
LOCALCVAR(myvar, "defaultvalue", CVAR_SOMEFLAGS);
return myvar->value;
}
will define a cvar, register it the first time the function is execed, and be reasonably speedy the other times, while hiding what its doing away from prying eyes.
Requires C99/C++ though.
Or you could use a constructor in C++ to create the cvar when it comes into scope (or just use static to make that scope a bit more global), though you'd need some decent methods.
imho preprocessor magic isn't really any worse than classes, so long as you don't use it in public APIs...