From 16d2fcf2e95531dd07d8eab6e4d572b684fa9d15 Mon Sep 17 00:00:00 2001 From: Christian Thaeter Date: Sun, 14 Sep 2008 19:06:20 +0200 Subject: [PATCH] macro for initializing a uchar[16] from a string literal in C++ --- src/lib/luid.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/lib/luid.h b/src/lib/luid.h index a93d004a3..553d22765 100644 --- a/src/lib/luid.h +++ b/src/lib/luid.h @@ -31,6 +31,22 @@ */ typedef unsigned char lumiera_uid[16]; +typedef lumiera_uid* LumieraUid; + +/* + C++ can't initialize arrays from string literals with the trailing \0 cropped + C can't initialize non constant members, + there we go +*/ +#ifdef __cplusplus +#define LUMIERA_UID_INITIALIZER(l) \ + { \ + l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7], \ + l[8], l[9], l[10], l[11], l[12], l[13], l[14], l[15] \ + } +#else +#define LUMIERA_UID_INITIALIZER(l) l +#endif /** * Retrieve a generic pointer stored in a luid