Welcome to the Monastery | |
PerlMonks |
Re: Re: (s)printf and rounding woesby nevyn (Monk) |
on Nov 05, 2003 at 11:57 UTC ( [id://304701]=note: print w/replies, xml ) | Need Help?? |
Now here is something a little bit off topic, but interesting. If you do this in c:It produces -167772160, which is ridiculous, as c tries to interprete that piece of memory as integer, as you required. Well gcc has had static format checking included for only at least 10 years. Which would give a warning on the above, and so make that mistake practically impossible. In fact there are solutions for printing arbitrary objects via. printf like mechanisms in C. Which might be nice in perl (if XS wasn't so ick I'd be happier to look at doing it). In fact, to be somewhat on topic, it can sometimes be pretty annoying that perl doesn't give any warnings if you do...
...although more annoying and probably easier to fix would be to have all the normal printf() POSIX extensions like "%'d" work.
-- James Antill
In Section
Seekers of Perl Wisdom
|
|