From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@9fans.net Date: Thu, 10 Sep 2009 09:30:38 +0000 From: comeau@panix.com (Greg Comeau) Message-ID: References: <1745bc1073a021783cf2ff8658d7ce47@quanstro.net>, <1d5d51400909090843h2905057et1a60474702faf0df@mail.gmail.com> Subject: Re: [9fans] porting help please (gcc void pointer handling) Topicbox-Message-UUID: 6c8a715a-ead5-11e9-9d60-3106f5b1d025 In article <1d5d51400909090843h2905057et1a60474702faf0df@mail.gmail.com>, Fernan Bolando wrote: >>> gcc happily compiles a definition like >>> #define CT_v249 =A0 =A0 =A0 ((void*)startLabel+464) >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 That looks right >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 Yes, the diagnostic and the gist of the wikipedia entry are correct: there is nothing to scale up a void * with, so normally such an operation has no meaning. But it's still not clear what you're eventually trying to do in/with the code in question, so changing the cast to an unsigned char * cast may not necessarily be the solution and/or best solution. -- Greg Comeau / 4.3.10.1 with C++0xisms now in beta! Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries... Have you tried it?