Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7k
Support printing constant strings containing nulls#5747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This only changes the behaviour of code like `Serial.print("Hello""\0""World")`, where writing the null byte is clearly intended.This also gives a speed boost for all calls with constant stringsmatthijskooijman commentedDec 23, 2016
I'm not so sure if this is really a good idea, since now: and Will have different results and I'm not sure that's really a good idea. Also, Ithink that: will now print 10 bytes, even though only 2 is intended. Since this sort of thing is likely to occur in sketches, this breaks compatibility. Regarding handling of strings with embedded zeroes, you might be interested in#1936 which improves the String class to better handle them. |
PaulStoffregen commentedDec 23, 2016
Isn't this what write(buf, length) is supposed to do? Ideally, both write() functions ought to take (const void *) type, but whether even that can be considered changeable at this late stage in Arduino's development is a good question? |
eric-wieser commentedDec 23, 2016
Yep, you're right - this is not an acceptable change |
Uh oh!
There was an error while loading.Please reload this page.
What's changed
Serial.print("Hello""\0""World")HelloHello\0WorldSerial.print("Hello")strlenSerial.println("Hello")strlenThoughts?