#300 throw warn 178 when gcc-style void * arithmetic is used

open
nobody
5
2010-10-12
2010-10-12
No

The code below uses gcc-style pointer arithmetic.
sdcc does not generate warning 178 while compiling it, whereas gcc -Wpointer-arith does.

Needless to say, when compiled with sdcc, the snippet below does not achieve what the developer intended.

static unsigned short foo[15];
void funct() {
void * ptr;
ptr = foo; /* ptr is X:0xe01a */
/* do something */
ptr = (void *)foo + 1; /* ptr is still X:0xe01a while the developer thought it would be 0xe01b */
}

Discussion

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks