Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 443969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:13:25+00:00 2026-05-12T21:13:25+00:00

The C# language (and other languages I’m sure) require suffixes at the end of

  • 0

The C# language (and other languages I’m sure) require suffixes at the end of numeric literals. These suffixes indicate the type of the literal. For example, 5m is a decimal, 5f is a floating point number.

My question is: are these suffixes really necessary, or is it possible to infer the type of a literal from its context?

For example, the code decimal d = 5.0 should infer that 5.0 is not a double, but a decimal. Does that kind of grammar cause problems?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T21:13:26+00:00Added an answer on May 12, 2026 at 9:13 pm

    That’s fine for simple cases like:

    float f = 7;
    

    but it’s far better to be explicit so that you don’t have to worry about statements like:

    float f = (double)(int)(1 / 3 + 6e22 / (double)7);
    

    Yes, I know that’s a contrived example but we don’t know the intent of the coder from just the type on the left, especially if it’s not being assigned to a variable at all (such as being passed as an argument to an overloaded function that can take one of int, float, double, decimal et al).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When learning new languages such as C++ from PHP, does reading other language snippets
In other languages (for example C#)we have a data directory (directory that our program's
What languages other than C and C++ have explicit reference and pointer type qualifiers?
I'm setting up a multi-language using gettext. Since all text from other languages are
I learned that JavaScript is a loosely-typed language. What other languages are loosely-typed?
I have imported some other languages to my shop. When I change the language,
If I am not wrong Chinese language (and other languages) doesn't use space '
I'm wondering why C++ (and possibly other languages, I'm not sure) doesn't allow statements
I have in Java (similar in other languages, problem should be language independent) a
Can SharpDevelop support language plugins for other languages, not just .NET languages?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.