Keil Logo

GENERAL: VALID VALUE ASSIGNMENT CREATES WARNING


Information in this article applies to:

  • ANSI C Compiler

QUESTION

I use the following assignment in my code:

unsigned long v = 2147483648;

This assignment creates a compiler warning that I cannot understand:

warning:  #1134-D: literal treated as "long long"

ANSWER

The warning indicates that your expression exceedes the value range for long which is -2147483648 .. +2147483647. The ANSI standard explicitly requests that plain decimal numbers are considered as signed long constants. Another reason for this warning might be that the expression really exceeds the value range.

For plain decimal values you may use the prefix U to avoid the warning.

Example:

unsigned long v = 2147483648U;

SEE ALSO

Last Reviewed: Thursday, November 22, 2007


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.