[CMake] 2D arrays

Robert Dailey rcdailey at gmail.com
Tue Nov 29 21:29:45 EST 2011


On Tue, Nov 29, 2011 at 5:57 PM, Michael Hertling <mhertling at online.de>wrote:

> Just some spontaneous questions/remarks:
>

Thanks; I really appreciate it!


> - Why do you use macros instead of functions?
>

I use macros so the _array2d_ variables fall through the scope of the macro
and are available in the next call to array2d_advance(). I could use
functions + properties but this solution works, I saw no need to use the
slightly more verbose global properties feature.


> - What's about cleaning up the numerous helper variables,
>  e.g. by an additional array2d_cleanup() function or the like?
>

What specific helper variables are you referring to? I would most likely
use more uniquely mangled local variables instead, but I figured the
preceeding underscore in front of each was sufficient. What would you
recommend here? I'd like to avoid a cleanup() method because it seems
unnecessary. If my local variables cause conflicts later, and if name
mangling isn't the idiomatic solution, I'd like to hear whatever idea you
have (that doesn't involve cleanup() if possible).

- In array2d_begin_loop(), couldn't you rearrange the parameters,
>  array2d_begin_loop(advanced "fruit;animal" ${two_dee_array}), use
>  LIST(LENGTH var_names _array2d_width) and take ARGN as the array?
>

What would this buy me? Typically I've avoided ARGN unless it is absolutely
necessary, but a variable in this case seems more direct. Can you explain
what benefits this has?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111129/083b13da/attachment.htm>


More information about the CMake mailing list