Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

18 lines (13 sloc) 0.634 kB
//-------=====================<<<< COPYRIGHT >>>>========================-------
// Copyright (c) 2004-2005 David Caldwell, No Rights Reserved. Feel Free.
//-------================================================================-------
#ifndef __LENGTHOF_H__
#define __LENGTHOF_H__
#ifdef __cplusplus
#define lengthof(x) (sizeof(x)/sizeof(*(x)))
#else
#define __compile_assert(e) sizeof(char[1-2*!(e)]) // expression version of compile_assert()
#define lengthof(x) (sizeof(x)/sizeof(*(x)) + \
0*__compile_assert(!__builtin_types_compatible_p(typeof(x),typeof(&(x)[0]))))
#endif
#endif /* __LENGTHOF_H__ */
Jump to Line
Something went wrong with that request. Please try again.