'scuse me if this has been asked before, but I did have a look around for it!
Why does VC++ use _itoa etc whereas the ansi standard is itoa (no leading underscore)?
Please enlighten a beginner!
Cheers,
Rob.
'scuse me if this has been asked before, but I did have a look around for it!
Why does VC++ use _itoa etc whereas the ansi standard is itoa (no leading underscore)?
Please enlighten a beginner!
Cheers,
Rob.
Because compiler companies frequently change certain things (funcitons, etc.). You'd be hard pressed to find a totally ANSI compliant compiler.
-Govtcheez
[email protected]
The standard says no such thing. itoa() is a non-standard function (there's atoi(), but not itoa()). The standard way of converting an int to a string is to either use sprintf() or a stringstream.
So...... VC uses _itoa to indicate that it's not an ansi standard function?
That may be why they've used an underscore, they do similar things with _getch(), _putch(). However the MSVC compiler will accept the function names without the underscore.
There's also lots of other non-standard stuff (the API) that doesn't use underscores so I wouldn't rely on the absense of an underscore to mean the function's ANSI.
That's when I noticed it. Tried to compile some code with Turbo C++ and it objected until I removed the underscore. Then compiled fine under VC without it.However the MSVC compiler will accept the function names without the underscore.
Many thanks.
Rob.
I think you'd be hard pressed to find a compiler that was. MSVC++ 6.0 was released before there was an official C++ standard (although their next effort still isn't completely compliant).
>You'd be hard pressed to find a totally ANSI compliant compiler.
How true, you have to be very careful when trying to write compliant or portable code because compilers try to sneak implementation defined and nonstandard functions onto you. A copy of the ISO standard is most useful
-Prelude
My best code is written with the delete key.