diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:48 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:48 +0300 |
commit | 9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /util/system/defaults.h | |
parent | 8cbc307de0221f84c80c42dcbe07d40727537e2c (diff) | |
download | ydb-9abfb1a53b7f7b791444d1378e645d8fad9b06ed.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system/defaults.h')
-rw-r--r-- | util/system/defaults.h | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/util/system/defaults.h b/util/system/defaults.h index b2b5756b34..dcd7abea38 100644 --- a/util/system/defaults.h +++ b/util/system/defaults.h @@ -74,7 +74,7 @@ #endif #include "compiler.h" - + #ifdef _win_ #include <malloc.h> #elif defined(_sun_) @@ -93,33 +93,33 @@ constexpr bool Y_IS_DEBUG_BUILD = true; #endif #endif -/** - * @def Y_ARRAY_SIZE - * - * This macro is needed to get number of elements in a statically allocated fixed size array. The - * expression is a compile-time constant and therefore can be used in compile time computations. - * - * @code - * enum ENumbers { - * EN_ONE, - * EN_TWO, - * EN_SIZE - * } - * - * const char* NAMES[] = { - * "one", - * "two" - * } - * - * static_assert(Y_ARRAY_SIZE(NAMES) == EN_SIZE, "you should define `NAME` for each enumeration"); - * @endcode - * - * This macro also catches type errors. If you see a compiler error like "warning: division by zero - * is undefined" when using `Y_ARRAY_SIZE` then you are probably giving it a pointer. - * - * Since all of our code is expected to work on a 64 bit platform where pointers are 8 bytes we may - * falsefully accept pointers to types of sizes that are divisors of 8 (1, 2, 4 and 8). - */ +/** + * @def Y_ARRAY_SIZE + * + * This macro is needed to get number of elements in a statically allocated fixed size array. The + * expression is a compile-time constant and therefore can be used in compile time computations. + * + * @code + * enum ENumbers { + * EN_ONE, + * EN_TWO, + * EN_SIZE + * } + * + * const char* NAMES[] = { + * "one", + * "two" + * } + * + * static_assert(Y_ARRAY_SIZE(NAMES) == EN_SIZE, "you should define `NAME` for each enumeration"); + * @endcode + * + * This macro also catches type errors. If you see a compiler error like "warning: division by zero + * is undefined" when using `Y_ARRAY_SIZE` then you are probably giving it a pointer. + * + * Since all of our code is expected to work on a 64 bit platform where pointers are 8 bytes we may + * falsefully accept pointers to types of sizes that are divisors of 8 (1, 2, 4 and 8). + */ #if defined(__cplusplus) #include <util/generic/array_size.h> #else @@ -128,11 +128,11 @@ constexpr bool Y_IS_DEBUG_BUILD = true; ((sizeof(arr) / sizeof((arr)[0])) / static_cast<size_t>(!(sizeof(arr) % sizeof((arr)[0])))) #endif -#undef Y_ARRAY_BEGIN -#define Y_ARRAY_BEGIN(arr) (arr) +#undef Y_ARRAY_BEGIN +#define Y_ARRAY_BEGIN(arr) (arr) -#undef Y_ARRAY_END -#define Y_ARRAY_END(arr) ((arr) + Y_ARRAY_SIZE(arr)) +#undef Y_ARRAY_END +#define Y_ARRAY_END(arr) ((arr) + Y_ARRAY_SIZE(arr)) /** * Concatenates two symbols, even if one of them is itself a macro. @@ -148,7 +148,7 @@ constexpr bool Y_IS_DEBUG_BUILD = true; #define Y_GENERATE_UNIQUE_ID(N) Y_CAT(N, __COUNTER__) #endif -#if !defined(Y_GENERATE_UNIQUE_ID) +#if !defined(Y_GENERATE_UNIQUE_ID) #define Y_GENERATE_UNIQUE_ID(N) Y_CAT(N, __LINE__) #endif |