Pages: [1]   Go Down
Author Topic: Adding Streaming library to the Arduino core  (Read 1424 times)
0 Members and 1 Guest are viewing this topic.
Maastricht Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 34
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Streaming is an important c++ feature, therefore I don't understand why including of the Streaming library to the Arduino core was rejected. See here:
http://arduiniana.org/libraries/streaming/
Streaming makes printing text easier and the library is efficient, it generates no extra machinecode.
I hope the Arduino staff will add this library to the Arduino core or to the Contributed Libraries” list.
Logged

Norway@Oslo
Offline Offline
Edison Member
*
Karma: 13
Posts: 2033
loveArduino(true);
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Streaming is an important c++ feature
Although it is an important c++ it does not imply that it should be a key feature of Arduino.
The ''stream insertion operator'' << and >> which actually is bit shift operators have caused quite a few discussions, and even more questions.
Many people find them cryptic, I've always though 'shift all the bytes of the string (or the object) into' whatever happenes to use/call the operator << or >>.

I think teaching function calls is better, and it looks cleaner, than stream insertion does. Although it results in longer code.

Quote
Streaming makes printing text easier and the library is efficient, it generates no extra machinecode.
I hope the Arduino staff will add this library to the Arduino core or to the Contributed Libraries[ch8221] list.

Although I've mostly argued against I agree.  smiley
Logged

Maastricht Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 34
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, here I disagree.

Function calls cost many lines:
lcd.print("GPS #");
lcd.print(gpsno);
lcd.print(" date: ");
lcd.print(day);
lcd.print("-");
lcd.print(month);
lcd.print("-");
lcd.println(year);

With streaming everything can be written in one line:
lcd << "GPS #" << gpsno << " date: " << day << "-" << month << "-" << year << endl;

I prefer streaming and it generates no extra byte of code at all.
Logged

Florida
Offline Offline
Full Member
***
Karma: 0
Posts: 171
1 Cor 10:31
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I know its nice to have it as default but it doesnt seem like that big a deal to insert
Code:
template<class T> inline Print &operator <<(Print &obj, T arg) { obj.print(arg); return obj; }
Logged

Pages: [1]   Go Up
Jump to: