Open GoogleCodeExporter opened 9 years ago
This is probably caused by the switch from the old oro.jar regular-expressions
to the standard Java ones:
<https://github.com/arduino/Arduino/commit/fa4d0582970e50c574ecfdcdbcfeae3754ca2
095>. Properly generating function prototypes for the full range of C++ syntax
is tricky, so you might be better off putting the templated function
definitions in a separate header file in your sketch, which won't be
pre-processed.
Patches to the pre-processing code are welcome, too, although need to be well
tested.
Original comment by dmel...@gmail.com
on 21 Feb 2011 at 3:42
Might it be helpful to put something in the programming documentation to this
effect (that is, template functions are best pushed to separate header files
that don't get pre-processed)?
I looked over the regex for the change, this would've bounced on the Perl5
regex class in oro.jar, I'm pretty sure. Unless the submitter knows otherwise.
Original comment by WineBizR...@gmail.com
on 9 Mar 2011 at 6:48
This is still active in version 1.0.1 of the IDE. Simple example:
template <typename T> T myAbs (const T a)
{
return (a < 0) ? - a : a;
} // end of myAbs
void setup () {}
void loop () {}
Gives error:
sketch_jun21a:-1: error: 'T' does not name a type
It can't be too hard to fix the regexp to at least handle that, and similar,
can it? eg.
Optional: template < ... > preceding the function declaration.
Original comment by n...@gammon.com.au
on 20 Jun 2012 at 9:06
Original comment by dmel...@gmail.com
on 31 Jul 2012 at 12:48
New preprocessor tracked at https://github.com/arduino/Arduino/pull/2636.
Builds for testing it are available
Original comment by federico...@gmail.com
on 13 Feb 2015 at 7:18
Original issue reported on code.google.com by
leomi...@gmail.com
on 6 Feb 2011 at 3:31