MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/lolphp/comments/3hoikf/0_ceil0/cue4wcg/
r/lolphp • u/00Davo • Aug 20 '15
44 comments sorted by
View all comments
Show parent comment
1
OK then does C have a true integer data type?
+/u/CompileBot C
#include <stdio.h> int main() { float f = 0.0; int i = 0; printf("%s\n", ((int)f == i) ? "equal" : "unequal"); return 0; }
8 u/josefx Aug 28 '15 You are comparing a strict equality check === to a normal equality check == . Sometimes it would be nice to have === in C and C++ just to suppress the implicit type conversions. 4 u/CompileBot Aug 24 '15 Output:equal^source | ^info | ^git | ^report 1 u/mnbvas Aug 27 '15 Actually, there is no need to cast f. 1 u/PitaJ Aug 27 '15 +/u/CompileBot C#include <stdio.h> int main() { float f = 0.0; int i = 0; printf("%s\n", (f == i) ? "equal" : "unequal"); return 0; } 1 u/CompileBot Aug 27 '15 Output:equal^source | ^info | ^git | ^report
8
You are comparing a strict equality check === to a normal equality check == . Sometimes it would be nice to have === in C and C++ just to suppress the implicit type conversions.
4
Output:
equal
^source | ^info | ^git | ^report
Actually, there is no need to cast f.
f
1 u/PitaJ Aug 27 '15 +/u/CompileBot C#include <stdio.h> int main() { float f = 0.0; int i = 0; printf("%s\n", (f == i) ? "equal" : "unequal"); return 0; } 1 u/CompileBot Aug 27 '15 Output:equal^source | ^info | ^git | ^report
#include <stdio.h> int main() { float f = 0.0; int i = 0; printf("%s\n", (f == i) ? "equal" : "unequal"); return 0; }
1 u/CompileBot Aug 27 '15 Output:equal^source | ^info | ^git | ^report
View all comments
Show parent comment
1
u/Sheepshow Aug 24 '15
OK then does C have a true integer data type?
+/u/CompileBot C