|
|
>> Ah yes, C++ is a superset of C. But I was thinking (hoping?) that in
>> C++ you have something less hellish than prinf() to play with...
>
> You do.
>
> C:
> printf("Number is: %d\n", somenumber);
>
> ...and be careful types match between format string and arguments
> passed, and particularly that you passed *enough* arguments
>
> C++:
> cout << "Number is: " << somenumber << "\n";
>
> ...and there is no duplicated information that could get out-of-sync
> (format and arguments).
>
> It's just you can still use the C way if you want to.
That does indeed seem like at least *some* improvement...
(In C, almost every single time anybody touched printf(), the compiler
would utter something about "suspicious pointer conversion". To this day
nobody knows what that actually means... Even the tutors didn't seem to
know.)
Post a reply to this message
|
|