On 09/28/2013 06:29 AM, ollie wrote:
On Fri, 27 Sep 2013 22:23:43 +0200, Mike Wey wrote:
How is toStringArray limited to 10 strings?
In
src/glib/Str.d
at line 190:public static string[] toStringArray(char** args) { if ( args is null ) { return null; } string[] argv; char* arg = args[0]; int i=0; while( (arg) != null && i<10) { argv ~= toString(arg); ++i; arg = args[i]; } return argv; }
Because of the
i
in thewhile
loop. As long asarg
points to a valid string andi<10
concat to argv. Ifi==10
stop looping even if arg points to a valid string.I don't know if this is an arbitrary limit or some underlying need for that limit.
The 10 does seem arbitrary, the original commit mentions it's a bugfix
but not for what and why 10.