Suffixes for numerical constants in C: when should they be used?

40 Views Asked by At

I've used C for scientific programming for more than 15 years and I've never needed suffixes like F and L for numerical literals. I wonder why some very experienced programmers almost always use them. Here are two examples:

float x = 1.5F;
unsigned short *biosPtr = (unsigned short *)0x400000L;

Obviously, there are other cases where the suffixes are important. For example

(-1 < 100)

is true, but

(-1 < 100U)

is false.

0

There are 0 best solutions below