On Wed, Sep 9, 2009 at 11:35 PM, erik quanstrom<quans...@quanstro.net> wrote:
>> gcc happily compiles a definition like
>> #define CT_v249       ((void*)startLabel+464)
>>
>
> no it doesn't.
>
> $ cat > x.c
> char    *startlab;
> long long offset = (void*)startlab+464;
> [...]
> $ gcc -Wall x.c
> x.c:2: error: initializer element is not constant
> [...]
>
I may not have posted the appropriate section of the code but, the app
that I am porting have a bunch of those and I always get for all the
section that calls those defines
AsciiTab.hc.c:140[stdin:1124] pointer addition not fully declared: VOID



After googling I found this in wikipedia
"Pointer arithmetic cannot be performed on void pointers because the
void type has no size, and thus the pointed address can not be added
to, although gcc and other compilers will perform byte arithmetic on
void* as a non-standard extension. For working 'directly' with bytes
they usually cast pointers to BYTE*, or unsigned char* if BYTE isn't
defined in the standard library used."

So I assumed that was the problem



-- 
http://www.fernski.com

Reply via email to