I have the following code
int myInt;
sscanf(str, "%d=%s", &myInt, str);
Will this be valid? Is there a better way to do this if I have it in a loop?
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.
My guess is that this wil usually work because it seems like the source string will always be >= the result string, and that would seem to cause deterministic and as-specified results.
But I still wouldn’t do it. Library functions typically have
restrict-qualified parameters in order to allow for optimizations and prefetch.Don’t tempt the compiler.