Re:Why 1 && 2 == 2
by rayiner on Thursday July 18, 2013 @11:50PM
(#6068227)
Or didn't put a format specifier, which makes sense coming from languages that don't have one in their print statements.
[ Parent
| on HN ]
Not putting a format specifier wouldn't cause a segfault.
[deleted]
Well, there is a difference between "format specifier" and "format string". The first argument to printf is the format string, the `%d` and `%s` type things are the format specifiers. I was talking about this
printf("Hi", 45);
which will not segfault. If you meant printf(45);
Then you are absolutely correct, that would segfault on common machines.I think that must be it. And it makes perfect sense how he would hit it. Example: http://ideone.com/MilaUN
Deleted my comment because you are, of course, correct. (However, I do suspect rayiner was referring to omitting the format string.)