federico-busato / federico-busato/Modern-CPP-Programming
Prefix increment example in Basic Concepts I (html) is wrong (?)
- Dominant language
- HTML
- Stars
- 16.1k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hi! Sharing the compiler explorer link reproducing the example: https://godbolt.org/z/5sneMPP1j
The example on slide 20,
```
i = 0;i = i++ + 2; // since C++17: i = 3, before: undefined behavior
```
claims that output will be 3, but compiling from C++17,20 etc shows the output to be 2, on arm64-darwin, which is what you'd expect in the first place (at least, as per the explanation in the earlier slides)
Contributor guide
Research direction
Start with slide 20 in Basic Concepts I and reproduce the linked Compiler Explorer example under C++17 and later standards. Check the stated result and explanation against the observed behavior, then update the example so its output and wording are accurate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 76/100