What do atoi, atol, and stoi stand for?

yesennes picture yesennes · Jun 15, 2016 · Viewed 6.9k times · Source

I understand what said functions do, but I can't guess how their names were created, except that the last letter is from the return type.

Answer

101010 picture 101010 · Jun 15, 2016
atoi  -> ASCII to integer.
atol  -> ASCII to long.
atof  -> ASCII to floating.
stoi  -> string to integer.
stol  -> string to long.
stoll -> string to long long.
stof  -> string to float. 
stod  -> string to double.
stold -> string to long double.

atoi, atol, atof come from C and its godfather most probably is considered to be Ken Thompson the co-creator of the UNIX operating system and the creator of the B programming language which is the predecessor of the C programming language. The names are mentioned in the first UNIX Programmer's Manual November 3, 1971 and as you can see in the owner's label ken is mentioned which is the nickname of Ken Thomson:

enter image description here

enter image description here

stoi, stol, stoll, stof, stod and stold got in C++ since C++11. Consequently, the naming must have been a unanimous decision of the C++ committee. The original proposal N1803 though dates back in 2005. I couldn't find in the proposal why the named these functions after these names. My guess is that probably they wanted to keep the uniformity with their C "equivalents" mentioned above.