본문 바로가기
csapp

2.2.8 Advice on Signed versus Unsigned

by 정구지개발자 2023. 4. 5.
728x90
  • We have seen multiple ways in which the subtle features of unsigned arith- metic, and especially the implicit conversion of signed to unsigned, can lead to errors or vulnerabilities. One way to avoid such bugs is to never use unsigned numbers

2.3 Integer Arithmetic

  • Many beginning programmers are surprised to find that adding two positive num- bers can yield a negative result, and that the comparison x < y can yield a different result than the comparison x-y < 0

2.3.1 Unsigned Addition

 

2.3.2 Two’s-Complement Addition

728x90

'csapp' 카테고리의 다른 글

3.2.3 Notes on Formatting  (0) 2023.04.07
3 Machine-Level Representation of Programs  (0) 2023.04.06
2.2.5 Signed versus Unsigned in C  (0) 2023.04.04
2.2.2 Unsigned Encodings  (0) 2023.04.02
2.1.7 Bit-Level Operations in C  (0) 2023.03.31

댓글