ARM Technical Support Knowledge Articles

VALID VALUE ASSIGNMENT CREATES WARNING

Applies to: General Topics

Answer


Information in this article applies to:


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

ATTACHED FILES

Request the files attached to this knowledgebase article.

Article last edited on: 2007-11-22 23:25:37

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential