Undocumented "printf()" funnies
- Posted by Alan Oxley <fizzpop at icon.co.za> Feb 04, 2005
- 455 views
Hi, some observations with Eu 2.5a: If you leave out the "%" symbol in a printf, then its not an error, you simply get the string within the quotes printed. Would it not be better to either document this, or have euphoria return "Unknown printf format" as it does if you tried printf(1,"%k",0) Where "%k" is the rubbish demo. Most incorrect formatting attempt within the printf quotes is not picked up by initial parsing, only at execution time. Since you cannot use variables within the quotes, there is no reason not to have this parsed? Attempting to use two decimal places is also unsupported, but it does not give a parse error, but simply a strange result:
atom a a = 100000001 printf(1,"%3.3.3d",a)
will display ".3ld" (Where does the "l" come from?) This is also the case with eu2.4 official. Yes, I know I can get the result I want with multiple printf's but this is to demonstrate the problem. I also know that pretty print is not printf! Regards, Alan