Skip to content

Suggestion boolean as int like in C/C++ #96569

Closed Answered by tannergooding
DeafMan1983 asked this question in Ideas
Discussion options

You must be logged in to vote

This would be a suggestion for https://github.com/dotnet/csharplang

It's worth noting, however, that this has been proposed before (having trouble finding the issue at the moment) and it is unlikely to ever happen. The decision to not allow integers to be implicitly treated as booleans was a very explicit design decision and avoids a number of issues that exist around such behavior. The behavior in C/C++ has led to various real world issues, CVEs, etc and modern languages have almost universally avoided that behavior accordingly.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by danmoseley
Comment options

You must be logged in to vote
2 replies
@tannergooding
Comment options

@Clockwork-Muse
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants