diff options
author | Owen Taylor <otaylor@redhat.com> | 2000-01-21 15:27:39 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-01-21 15:27:39 +0000 |
commit | 948f64a183b75de140fd86fefd72b35fda082887 (patch) | |
tree | eb1ada483f08d680217810b7b341305cb84456ec /glib.h | |
parent | 9bee3ef88d3b68235a382254c3d3ba712325014c (diff) | |
download | glib-948f64a183b75de140fd86fefd72b35fda082887.tar.gz |
Added G_N_ELEMENTS macro to determine the number of elements in an array.
Fri Jan 21 10:18:24 2000 Owen Taylor <otaylor@redhat.com>
* glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
the number of elements in an array.
Diffstat (limited to 'glib.h')
-rw-r--r-- | glib.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -134,6 +134,11 @@ extern "C" { #define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string) #define G_STRINGIFY_ARG(contents) #contents +/* Count the number of elements in an array. The array must be defined + * as such; using this with a dynamically allocated array will give + * incorrect results. + */ +#define G_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0])) /* Define G_VA_COPY() to do the right thing for copying va_list variables. * glibconfig.h may have already defined G_VA_COPY as va_copy or __va_copy. |