Is there a maximum string length for newlib stdio functions? I am getting weird crashes of db101 possibly because of strings of about 12000 bytes in the stabs section... The question is: Is there a limit? How can one know this limit? What is the best workaround for strings longer than this limit?
Mon, 2012-11-05 23:43
#1
Maximum string length in Newlib
newlib.library handles C strings only which by definition have no maximum length. The only limit is the trailing NUL byte.
This is true, but ofcourse the string characters must accessed by an array index or some similar.
But I would be suprised if newlib was using anything other than signed ints for that internally and even a short would give a max size of '32768'
Wrong. It might look hackish, but in C you can iterate over a string without any kind of integer index. You just have to manipulate a pointer.
For example:
This will go to the end of the string, no matter how long it is, and without any kind of index.
Thanks for the answers, turns out, that the problem was caused by something completely different... Next time, I will use the DebugPrintF properly, so I don't end up thinking something not right about the cause of my problems...
@alfkil
Maybe next time you can use DB101 also. Very useful tool! :-P