federico-busato / federico-busato/Modern-CPP-Programming

Prefix increment example in Basic Concepts I (html) is wrong (?)

Open Beginner friendly
#210 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.