Suggestion boolean as int like in C/C++ #96569
-
Hello everyone, I would like to suggest in next version of language version should to pass Example:
or if else statement:
And more features - we would to request with Because I already ported Gtk3 in C# without But I don't like to change to bool because I want to stay original porting 1:1. example from gmarcos.h
But it seems I hope you understand my English. Sorry my bad English! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
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. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
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.