Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[basic.indet] Indeterminate values #2573

Merged
merged 1 commit into from Dec 8, 2018
Merged

Conversation

jensmaurer
Copy link
Member

Create a new section, moved from parts of [dcl.init].

Create a new section, moved from parts of [dcl.init].
unsigned char c;
unsigned char d = c; // OK, \tcode{d} has an indeterminate value
int e = d; // undefined behavior
return b ? d : 0; // undefined behavior if \tcode{b} is \tcode{true}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if b is indeterminate? 🤡

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is "if" not "if and only if"; we're not ruing out other possible sources of undefined behavior here. (But I think it's also not possible to call a function in a way that fails to initialize a parameter of type bool -- you'd encounter undefined behavior in the caller first.)

@zygoloid zygoloid merged commit 5aaec13 into cplusplus:master Dec 8, 2018
@jensmaurer jensmaurer deleted the b8 branch December 8, 2018 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants