having to learn the basics of templates
This only works for gcc as it is a gcc extension. Does anybody use anything else...
I don't see how the bugs imposed on #defines are a trade off for secure guaranteed execution of a well defined template.This would save mass amounts of headaches.
However I agree, the solution needs to be workable in C...
Why does the solution need to work in C ?
QuoteThis only works for gcc as it is a gcc extension. Does anybody use anything else... Good question. The Arduino folks are trying to add support for more processor types (like ARM). There is a possibility that a non-GCC compiler may come into play.
Technically unexpected behaviour is a bug.Documentation specifying the 'unexpected behaviour' makes it an 'undefined behaviour' and explicitly leaves it to the programmer to investigate, this however is not the case.Vastly different to having an explicitly defined error in your own code.However I agree, the solution needs to be workable in C & C++.that is as easy as a #ifdef for the C++ define, which leaves reason to provide a safer version when possible.
@bperrybap: Are you claiming that the Arduino folks, for the foreseeable future, will only be using GCC?
I believe that a final solution needs to work for both C and C++
Quote from: bperrybap on Jan 03, 2012, 08:40 amI believe that a final solution needs to work for both C and C++Why for C?
Why create a C++ only solution?
Not everything in Arduino is C++ ... There is core code that is C
and there are some libraries that use C++ wrappers on top of C code.