diff --git a/src/include/fb_types.h b/src/include/fb_types.h index 24ecf03d56..1daeff94a2 100644 --- a/src/include/fb_types.h +++ b/src/include/fb_types.h @@ -32,6 +32,7 @@ #ifndef INCLUDE_FB_TYPES_H #define INCLUDE_FB_TYPES_H +#include #include #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 +constexpr int FB_NELEM(const T (&)[N]) +{ + return N; +} // Intl types typedef SSHORT CHARSET_ID;