From: Mathieu Bouchard Date: 2006-10-07T12:52:58+09:00 Subject: Re: argument passing bug --8323328-1291085315-1160192875=:8637 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1291085315-1160192875=:8637" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1291085315-1160192875=:8637 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Fri, 6 Oct 2006, Mathieu Bouchard wrote: > ruby -e 'def foo(*x) x end; puts foo(*[42]*666).length' > #=3D> 156 > the argument count behaves almost mod 255. (why?) It's because, 1.892 (matz 09-Jun-06): if (argc >=3D 256) { 1.874 (matz 03-Feb-06): VALUE tmp; 1.874 (matz 03-Feb-06): VALUE *nargv; 1.892 (matz 09-Jun-06): int n =3D argc / 256 - 1; 1.874 (matz 03-Feb-06): 1.892 (matz 09-Jun-06): argc %=3D 256; 1.892 (matz 09-Jun-06): tmp =3D svalue_to_avalue(argv[argc]); 1.892 (matz 09-Jun-06): nargv =3D TMP_ALLOC(argc + RARRAY(tmp)->len += =20 n); 1.874 (matz 03-Feb-06): MEMCPY(nargv, argv, VALUE, argc); 1.874 (matz 03-Feb-06): MEMCPY(nargv+argc, RARRAY(tmp)->ptr, VALUE,=20 RARRAY(tmp)->len); 1.892 (matz 09-Jun-06): MEMCPY(nargv + argc + RARRAY(tmp)->len, argv= =20 + argc + 1, VALUE, n); 1.892 (matz 09-Jun-06): argc +=3D RARRAY(tmp)->len + n; 1.874 (matz 03-Feb-06): argv =3D nargv; 1.874 (matz 03-Feb-06): } cvs annotate -D 2006-06-12 eval.c |less to correct the problem, do cvs update -D 2006-06-08 _ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - t=E9l:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montr=E9al QC Canada --8323328-1291085315-1160192875=:8637-- --8323328-1291085315-1160192875=:8637--