1. Question/suggestion concerning printf()
- Posted by Juergen Luethje <j.lue at gmx.de> Mar 25, 2006
- 537 views
Hello Rob, if the number of values in the 3rd argument of printf() is smaller than the number of placeholders in the 2nd argument, then Euphoria will raise an error:
printf(1, "Text %d %d", {1}) --> not enough values to print in printf()
But if the number of values in the 3rd argument of printf() is *bigger* than the number of placeholders in the 2nd argument, then Euphoria will *not* raise an error:
printf(1, "Text %d %d", {1,2,3})
Is this intentional? Maybe if Euphoria would also raise an error in the second case, this would help to find some "hidden" bugs in our Eu programs? Just an idea. Regards, Juergen
2. Re: Question/suggestion concerning printf()
- Posted by Robert Craig <rds at RapidEuphoria.com> Mar 25, 2006
- 512 views
Juergen Luethje wrote: > if the number of values in the 3rd argument of printf() is smaller than > the number of placeholders in the 2nd argument, then Euphoria will raise > an error: > }}} <eucode> > printf(1, "Text %d %d", {1}) --> not enough values to print in printf() > </eucode> {{{ > > But if the number of values in the 3rd argument of printf() is *bigger* > than the number of placeholders in the 2nd argument, then Euphoria will > *not* raise an error: > }}} <eucode> > printf(1, "Text %d %d", {1,2,3}) > </eucode> {{{ > > Is this intentional? Maybe if Euphoria would also raise an error in the > second case, this would help to find some "hidden" bugs in our Eu > programs? Just an idea. Yes, it was done that way intentionally (about 14 years ago!). I don't think it would be a good idea to change it and break existing code. I feel it's better to be "permissive" about output formatting. If the output looks wrong, people can trace it back to the printf statement fairly easily, and correct it. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com