Renesas Technology, Tools FAQs
Last Updated: August 25, 2000
Document Number: 01051239_e
Q.
I defined a numerical value for the character string by the "#define" preprocess command. However, the operation of this expression
using this string did not result in the expected value. Why not?
In the following example, operation 'cul' does not result in the expected value, 0x04AAAA.
[Program Example]
#define V1 0x040000
#define V2 0x0AAAA + V1
cul = (WORD *)v2
A.
In the above program example, the result using '#define' becomes:
[Note] This '#define' expression results in a character string only (not a numerical value).
cul = ( WORD *)0x0AAAA+ 0x040000;
In this expression, the (WORD*) cast is only applicable for 0x0AAA. 0x040000 will be added to the expression, in other words,
added to the "int" pointer. Therefore, the result is 0x80000.
In order to get the proper value, place ( ) to the expression which you define with "#define".
[Program example]
#define V2 (0x0AAAA + V1)
Top of Page | Back to Previous Page
Terms of Use Privacy Policy
(C)2004 Renesas Technology Corp., All Rights Reserved.
Comentarios a estos manuales