What “_” means? Why Microsoft adds this mark at the beginning?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Identifiers in the global namespace starting with
_are reserved for the implementation._snprintfis just a function that the implementation (Visual Studio) has provided. As to the rationale for that, Visual Studio implements C89, andsnprintfis part of a later C99 standard.Besides that, the semantics of both functions are different in the return type, which in
snprintfis always the number of characters that the formatted string takes (whether there was enough space in the buffer or not, while_snprintfwill return a negative number if there is not enough space in the buffer.That is, to allocate a buffer just large enough for the output you can do:
You cannot do that with
_snprintfas the only information that the function yields back is that the current size is not enough.