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.128 by root, Tue Nov 27 18:47:35 2018 UTC vs.
Revision 1.129 by root, Sat Dec 1 20:22:13 2018 UTC

55# define g_slice_alloc0(s) calloc (1, (s)) 55# define g_slice_alloc0(s) calloc (1, (s))
56# define g_slice_alloc(s) malloc ((s)) 56# define g_slice_alloc(s) malloc ((s))
57# define g_slice_free1(s,p) free ((p)) 57# define g_slice_free1(s,p) free ((p))
58#endif 58#endif
59 59
60// use C0X decltype for auto declarations until ISO C++ sanctifies them (if ever)
61#define auto(var,expr) decltype(expr) var = (expr)
62
63#if cplusplus_does_not_suck /* still sucks in codesize with gcc 6, although local types work now */
64// does not work for local types (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm)
65template<typename T, int N>
66static inline int array_length (const T (&arr)[N])
67{
68 return N;
69}
70#else
71#define array_length(name) (sizeof (name) / sizeof (name [0]))
72#endif
73
74// very ugly macro that basically declares and initialises a variable 60// very ugly macro that basically declares and initialises a variable
75// that is in scope for the next statement only 61// that is in scope for the next statement only
76// works only for stuff that can be assigned 0 and converts to false 62// works only for stuff that can be assigned 0 and converts to false
77// (note: works great for pointers) 63// (note: works great for pointers)
78// most ugly macro I ever wrote 64// most ugly macro I ever wrote

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines