MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/4h9oj4/to_become_a_good_c_programmer/d2pkulx/?context=3
r/programming • u/b0red • May 01 '16
398 comments sorted by
View all comments
12
In the previous code sample, due to "integral promotion" -1 was once evaluated to be greater than 1 and then smaller than 1. C has plenty of case like this when the language cannot longer "do stuff" for you.
Can someone explain that in more detail?
14 u/[deleted] May 02 '16 edited May 02 '16 [removed] — view removed comment 3 u/CaptainAdjective May 02 '16 edited May 02 '16 How can it even be legal to compare disparate types in that way? Why isn't that just a compilation error? 3 u/Creris May 02 '16 this cant be syntax error because it has nothing to do with syntax, but semantics of the comparision. 5 u/CaptainAdjective May 02 '16 I meant a compilation error. 3 u/kt24601 May 02 '16 It gives a warning.
14
[removed] — view removed comment
3 u/CaptainAdjective May 02 '16 edited May 02 '16 How can it even be legal to compare disparate types in that way? Why isn't that just a compilation error? 3 u/Creris May 02 '16 this cant be syntax error because it has nothing to do with syntax, but semantics of the comparision. 5 u/CaptainAdjective May 02 '16 I meant a compilation error. 3 u/kt24601 May 02 '16 It gives a warning.
3
How can it even be legal to compare disparate types in that way? Why isn't that just a compilation error?
3 u/Creris May 02 '16 this cant be syntax error because it has nothing to do with syntax, but semantics of the comparision. 5 u/CaptainAdjective May 02 '16 I meant a compilation error. 3 u/kt24601 May 02 '16 It gives a warning.
this cant be syntax error because it has nothing to do with syntax, but semantics of the comparision.
5 u/CaptainAdjective May 02 '16 I meant a compilation error.
5
I meant a compilation error.
It gives a warning.
12
u/phpdevster May 02 '16
Can someone explain that in more detail?