// The arraysize(arr) macro returns the # of elements in an array arr.
// The expression is a compile-time constant, and therefore can be
// used in defining new arrays, for example. If you use arraysize on
// a pointer by mistake, you will get a compile-time error.
//
// One caveat is that arraysize() doesn't accept any array of an
// anonymous type or a type defined inside a function. In these rare
// cases, you have to use the unsafe ARRAYSIZE() macro below. This is
// due to a limitation in C++'s template system. The limitation might
// eventually be removed, but it hasn't happened yet.
// This template function declaration is used in defining arraysize.
// Note that the function doesn't need an implementation, as we only
// use its type.
template <typename T, size_t N>
char (&ArraySizeHelper(T (&array)[N]))[N];
// That gcc wants both of these prototypes seems mysterious. VC, for
// its part, can't decide which to use (another mystery). Matching of
// template overloads: the final frontier.
#ifndef _MSC_VER
template <typename T, size_t N>
char (&ArraySizeHelper(const T (&array)[N]))[N];
#endif
#define arraysize(array) (sizeof(ArraySizeHelper(array)))
Я — программист, я замкнутый, угрюмый и асоциальный. Я не люблю общаться ни с кем, даже с программистами, разве что с животными.
Я ненавижу работать в команде, я равнодушен ко всему и циничен. Я не люблю унылый программисткий юмор.
Статья — вранье.
Интересно, а как у этих сервисов с надежностью?
Цены не такие уж маленькие, но есть ли гарантия, что заплатив, я не получу замирающую и сыплющуюся картинку?
Объясните мне, КАК?! можно написать код удаления старых файлов таким образом, чтобы удалить все файлы на системном разделе?
Это чья-то диверсия или что?
Бывает и такое?
Свободный художник. Рисую на PHP, JS, иногда верстка, Symfony 2, C++, Qt, Java и др.
С семерки я всё равно не уйду.
Я ненавижу работать в команде, я равнодушен ко всему и циничен. Я не люблю унылый программисткий юмор.
Статья — вранье.
Цены не такие уж маленькие, но есть ли гарантия, что заплатив, я не получу замирающую и сыплющуюся картинку?
P.S. «ананонсировал»
Это чья-то диверсия или что?