Change in Print.cpp brokes with Serial.begin()


have been following Subversion (svn) latest revisions but found a change that’s broking with Serial.begin(), at least for me.

From r1076 to r1077, David A. Mellis made the following change in Print.cpp (and in WString.h, not diff’ed here):

--- Print1076.cpp       Thu Nov  4 01:50:36 2010
+++ Print1077.cpp       Thu Nov  4 01:50:52 2010
@@ -45,7 +45,9 @@
 void Print::print(const String &s)
-  print(s.toCharArray());
+  for (int i = 0; i < s.length(); i++) {
+    write(s[i]);
+  }
 void Print::print(const char str[])

When I try to compile a sketch with this change, and include a Serial.begin() inside setup() like this

void setup() {

I get the following error


/usr/local/bin/avr-g++ -mmcu=atmega2560 -I. -DF_CPU=16000000 -I../../libs/hardware/cores/arduino -Os -o applet/perlduino.elf applet/perlduino.cpp -L. applet/core.a -lm
applet/core.a(Print.o): In function `Print::print(String const&)':
Print.cpp:(.text+0xa6): undefined reference to `String::operator[](unsigned int) const'
*** Error code 1

Stop in /home/dbolgheroni/tcc/arduino/projects/perlduino (line 202 of BSDmakefile).

I think it’s worth mentioning that I’m using OpenBSD as the OS, running avr-gcc 4.3.4.

What’s the exact purpose of this change?

Thank you.

What’s the exact purpose of this change?

Smaller upload image. Faster execution of void Print::print(const String &s).

Is it worth if it's breaking things?

The change and the error are not related.

How not? If I undo the change, e.g. backing to revision 1076, the compiler succeeds. Compiler problem?

And what about Serial.begin() in setup()? Is the syntax wrong? I don't think so.