ardupilot/libraries/AP_Common
Lucas De Marchi 7ba6f92eb5 AP_Common: give some type safety to ARRAY_SIZE macro
Now that most places in the code use the ARRAY_SIZE macro instead of
coding it by hand, let's use some type safety in its definition. This is
a C++ version of similar macros used in kmod, Linux kernel and the
source of them, ccan.

A C++ version like this is used in V8 (the JS engine) and other open
source projects.

The main benefit of this version is that you get a compile error if you
pass in a variable that's not an array. For example,

     Bla y[10];
     Bla *y_ptr = y;

     void foo(Bla x[])
     {
         // build error since x[] decay to a pointer in function
         // parameter
         for (int i = 0; i < ARRAY_SIZE(x); i++) {
             ...
         }

         // build error since y_ptr is not an array
	 for (int i = 0; i < ARRAY_SIZE(y_ptr); i++) {
             ...
	 }
     }

I added the additional specialization to allow arrays of size 0.
2015-09-28 18:20:14 +10:00
..
examples/AP_Common AP_Common: standardize inclusion of libaries headers 2015-08-11 16:28:42 +10:00
AP_Common.cpp AP_Common: standardize inclusion of libaries headers 2015-08-11 16:28:42 +10:00
AP_Common.h AP_Common: give some type safety to ARRAY_SIZE macro 2015-09-28 18:20:14 +10:00
AP_Test.h libraries: update license header to GPLv3 2013-08-30 13:01:39 +10:00
Arduino.h Build: added empty Arduino.h 2012-12-20 14:52:30 +11:00
c++.cpp AP_Common: standardize inclusion of libaries headers 2015-08-11 16:28:42 +10:00
keywords.txt Add support for 'new' and 'delete', so we can cons things on the fly. 2010-10-17 04:02:06 +00:00