diff options
author | Neil Hodgson <nyamatongwe@gmail.com> | 2014-01-21 09:45:29 +1100 |
---|---|---|
committer | Neil Hodgson <nyamatongwe@gmail.com> | 2014-01-21 09:45:29 +1100 |
commit | c63c9dc7ca058d1b352c14f8052769d541c7e955 (patch) | |
tree | 726bbd8e98196bc0b224448af3ed6227fae96d3e /lexlib/StringCopy.h | |
parent | 023603c25dfdc73b0a51baaf3309d1bf18e04261 (diff) | |
download | scintilla-mirror-c63c9dc7ca058d1b352c14f8052769d541c7e955.tar.gz |
Added ELEMENTS macro and use it to clarify determining size of arrays.
Diffstat (limited to 'lexlib/StringCopy.h')
-rw-r--r-- | lexlib/StringCopy.h | 3 |
1 files changed, 3 insertions, 0 deletions
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 <neilh@scintilla.org> // 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 |