Matthew Vines
Matthew Vines

Reputation: 27561

What is the 'd' in the literal 12d called?

I feel like I should know the answer to this, but I don't.

What is the type character on a numeric literal called?

double myDouble = 12d;
float myFloat = 10f;

I wanted to find a complete list of them today, but couldn't come up with what to ask Google to search for.

EDIT

Found a decent list if anyone is interested

http://www.undermyhat.org/blog/2009/08/secrets-and-lies-of-type-suffixes-in-c-and-vb-net/

Upvotes: 10

Views: 936

Answers (4)

Powerlord
Powerlord

Reputation: 88786

The C# 3.0 specification (MSWord file) refers to them as type-suffix, divided into two categories: integer-type-suffix and real-type-suffix.

integer-type-suffixes include:
U u - unsigned int
L l - long
UL Ul uL ul LU Lu lU lu - unsigned long

real-type-suffixes include:
F f - float
D d - double
M m - decimal

Upvotes: 9

JaredPar
JaredPar

Reputation: 754525

I don't know if there is an official term but the C# language spec commonly refers to them as type suffixes.

Upvotes: 12

John Rasch
John Rasch

Reputation: 63435

Numeric Literal Suffix

A list:

  • uint: u
  • long: l
  • ulong: ul
  • float: f
  • decimal: m

Upvotes: 12

David M
David M

Reputation: 72840

It's called a data type suffix.

Upvotes: 16

Related Questions