Proposal: Set default real type literal suffix as a compiler parameter #2627
Replies: 2 comments
-
There is a strong desire to avoid making dialects of C#. Otherwise a random c# file means a different thing depending upon which project it happens to be in. This doesn't seem to be the sort of thing that would offer enough benefit to deviate from this policy. |
Beta Was this translation helpful? Give feedback.
-
How frequently do you find yourself using literals that you have to explicitly set their type via one of these suffixes? Adding a compiler parameter to default to one suffix over the other seems like it'd be unnecessary complexity to save what feels like should be maybe a handful of characters over an entire codebase, while at the same time making it harder to understand what the code does by glancing at it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, C# uses double type for non-suffixed real type literals.
It can be moved to a compiler parameter, say 'default_real_literal' which can be set to d, m, or f.
This way, if you want to use only decimals in your code, you don't need to use M suffix everywhere.
Beta Was this translation helpful? Give feedback.
All reactions