ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/util.h
(Generate patch)

Comparing deliantra/server/include/util.h (file contents):
Revision 1.100 by root, Thu Apr 22 13:01:58 2010 UTC vs.
Revision 1.101 by root, Wed Apr 28 19:49:50 2010 UTC

55#endif 55#endif
56 56
57// use C0X decltype for auto declarations until ISO C++ sanctifies them (if ever) 57// use C0X decltype for auto declarations until ISO C++ sanctifies them (if ever)
58#define auto(var,expr) decltype(expr) var = (expr) 58#define auto(var,expr) decltype(expr) var = (expr)
59 59
60// could use the sizeof (arr) /( sizeof (arr [0]) here, but C++ is
61// much more obfuscated... :)
62
63template<typename T, int N>
64inline int array_length (const T (&arr)[N])
65{
66 return N;
67}
68
60// very ugly macro that basically declares and initialises a variable 69// very ugly macro that basically declares and initialises a variable
61// that is in scope for the next statement only 70// that is in scope for the next statement only
62// works only for stuff that can be assigned 0 and converts to false 71// works only for stuff that can be assigned 0 and converts to false
63// (note: works great for pointers) 72// (note: works great for pointers)
64// most ugly macro I ever wrote 73// most ugly macro I ever wrote

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines