8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:43:03 +01:00

Replace FB_NELEM macro by constexpr function.

This commit is contained in:
Adriano dos Santos Fernandes 2023-09-18 20:27:13 -03:00
parent 8c57b29f1c
commit 1d858667d8

View File

@ -32,6 +32,7 @@
#ifndef INCLUDE_FB_TYPES_H
#define INCLUDE_FB_TYPES_H
#include <cstddef>
#include <limits.h>
#if SIZEOF_LONG == 8
@ -132,8 +133,12 @@ vmslock.cpp:LOCK_convert() calls VMS' sys$enq that may require this signature,
but our code never uses the return value. */
typedef int (*lock_ast_t)(void*);
/* Number of elements in an array */
#define FB_NELEM(x) ((int)(sizeof(x) / sizeof(x[0])))
// Number of elements in an array
template <typename T, std::size_t N>
constexpr int FB_NELEM(const T (&)[N])
{
return N;
}
// Intl types
typedef SSHORT CHARSET_ID;