Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Re: Re: Re: I don't use printf enough

by bunnyman (Hermit)
on Oct 23, 2003 at 15:25 UTC ( #301612=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re: I don't use printf enough
in thread I don't use printf enough

printf is a C function, yet it would not be the preferred way of doing things in C.

That's half right - printf is a C function, but it is not preferred in C++. It is preferred in C, of course.

The reason why printf is not the best way in C++ is that the compiler cannot check the variable types. If you use "%s" to print a string, and then use an integer variable instead, the program crashes at run time. With perl it would just convert the integer into a string and not crash, and with C++ style I/O, it would print the integer as a string. Also, printf cannot be extended to print objects, it is only able to print a few built in types.


Comment on Re: Re: Re: Re: I don't use printf enough

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://301612]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-09-02 03:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (19 votes), past polls