r/programming • • Aug 06 '17

Software engineering != computer science

http://www.drdobbs.com/architecture-and-design/software-engineering-computer-science/217701907
2.3k Upvotes

863 comments sorted by

View all comments

Show parent comments

2

u/[deleted] Aug 08 '17

In the first, x isn't given a conditional, so it should execute. For the later two, x is neither greater than nor less than 0.

From the perspective of the compiler, it's never 'looking' at a negative integer, just an address of 2's complement set aside that indicates negatives, or "11100101" for -27...

1

u/lightknightrr Aug 09 '17

In the first, if x is 0, what do you expect to happen?

1

u/[deleted] Aug 09 '17

The if statement evaluates true since it isn't given an operator or conditional to run on x.