zwol: stylized sketch of a face in profile (Default)
[personal profile] zwol
if (constant == variable)
if (pointer != 0)
if (pointer != NULL)
if (boolean == true)

}
else {

fprintf(stdout, ...);

printf("%s", variable);
printf("string with no substitutions");
printf("\n"); // or any other single character

Date: 2009-08-15 09:27 am (UTC)
From: [identity profile] elsmi.livejournal.com
The last three are handy for uniformity. Most errors occur when someone goes starts thinking, right?

(In particular, I'd hesitate to deprecate printf("%s", variable) when its nearest cousin -- printf(variable) -- is so very nasty. Also, printf("%s", variable) gives you protection when variable may be NULL.)

Date: 2009-08-15 11:22 pm (UTC)
From: [identity profile] zwol.livejournal.com
You have an excellent point. Mainly I was grumping about those because the code I was working on couldn't even be consistent about using one of printf() and fprintf(stdout).

April 2017

S M T W T F S
      1
2345678
9101112131415
16171819 202122
23242526272829
30      

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 10th, 2026 11:50 pm
Powered by Dreamwidth Studios