From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <1745bc1073a021783cf2ff8658d7ce47@quanstro.net> References: <1d5d51400909090803n4c4d5b7ewba9dfe0573d02495@mail.gmail.com> <1745bc1073a021783cf2ff8658d7ce47@quanstro.net> Date: Wed, 9 Sep 2009 23:43:50 +0800 Message-ID: <1d5d51400909090843h2905057et1a60474702faf0df@mail.gmail.com> From: Fernan Bolando To: erik quanstrom Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: 9fans@9fans.net Subject: Re: [9fans] porting help please (gcc void pointer handling) Topicbox-Message-UUID: 6b705b54-ead5-11e9-9d60-3106f5b1d025 On Wed, Sep 9, 2009 at 11:35 PM, erik quanstrom wrot= e: >> gcc happily compiles a definition like >> #define CT_v249 =A0 =A0 =A0 ((void*)startLabel+464) >> > > no it doesn't. > > $ cat > x.c > char =A0 =A0*startlab; > long long offset =3D (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 --=20 http://www.fernski.com