Renesas Technology, Tools FAQs
Last Updated: July 21, 2000
Document Number: 01051232_e
Q.
When I specify command option -fextend_to_int and compile my file, the calculation result is sometimes different from what I
expected. Why is that?
A.
When the compiler sees this command option, the compiler extends char type variables to int type variables. Therefore, when the
following example is compiled with this option, the result will be different from the normal result.
[Example program]
main()
{
unsigned char c=0xff,cc=0x00;
if(c!=~cc)
printf("Ok\n"); /* with -fextend_to_int */
else
printf("NG\n"); /* without -fextend_to_int */
}
In this example, the compiler extends the char type variable to the int type variable first, then the compiler performs operator ~. As a
result, the upper side is always FF. Therefore, the result of this "if" comparison is TRUE.
Top of Page | Back to Previous Page
Terms of Use Privacy Policy
(C)2004 Renesas Technology Corp., All Rights Reserved.
Comentarios a estos manuales