From c63c9dc7ca058d1b352c14f8052769d541c7e955 Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Tue, 21 Jan 2014 09:45:29 +1100 Subject: Added ELEMENTS macro and use it to clarify determining size of arrays. --- lexlib/StringCopy.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lexlib/StringCopy.h') diff --git a/lexlib/StringCopy.h b/lexlib/StringCopy.h index caca49911..1812b4e35 100644 --- a/lexlib/StringCopy.h +++ b/lexlib/StringCopy.h @@ -1,6 +1,7 @@ // Scintilla source code edit control /** @file StringCopy.h ** Safe string copy function which always NUL terminates. + ** ELEMENTS macro for determining array sizes. **/ // Copyright 2013 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. @@ -26,6 +27,8 @@ void StringCopy(T (&dest)[count], const T* source) { dest[count-1] = 0; } +#define ELEMENTS(a) (sizeof(a) / sizeof(a[0])) + #ifdef SCI_NAMESPACE } #endif -- cgit v1.2.3