On Mon, Dec 31, 2001 at 03:51:37AM -0500, Lee Berger wrote: > that brings me to the next problem: string.c. there are a slew of > compile errors in this file, and it all is based on pointer math on void > pointers. for example, STRING has a void* bufstart member, and various > functions (like string_make) try to do pointer math with it. void > pointers have no size; therefore, pointer math won't work. visual c++ > enforces this, and i'm a little surprised that gcc doesn't. i guess it > just treats it as a char*?
yes by default: cc -O2 -I./include -DHAS_JIT -o string.o -c string.c cc -O2 -I./include -DHAS_JIT -o encoding.o -c encoding.c but: cc -O2 -Wpointer-arith -I./include -DHAS_JIT -o string.o -c string.c string.c: In function `string_make': string.c:64: warning: pointer of type `void *' used in arithmetic string.c: In function `string_transcode': string.c:171: warning: pointer of type `void *' used in arithmetic string.c:173: warning: pointer of type `void *' used in arithmetic string.c:186: warning: pointer of type `void *' used in subtraction string.c:188: warning: pointer of type `void *' used in arithmetic string.c: In function `string_concat': string.c:229: warning: pointer of type `void *' used in arithmetic string.c: In function `string_substr': string.c:311: warning: pointer of type `void *' used in subtraction string.c:312: warning: pointer of type `void *' used in subtraction string.c:314: warning: pointer of type `void *' used in arithmetic string.c: In function `string_chopn': string.c:328: warning: pointer of type `void *' used in arithmetic string.c:336: warning: pointer of type `void *' used in subtraction string.c:338: warning: pointer of type `void *' used in arithmetic string.c: In function `string_compare': string.c:362: warning: pointer of type `void *' used in arithmetic string.c:364: warning: pointer of type `void *' used in arithmetic string.c: In function `string_to_int': string.c:423: warning: pointer of type `void *' used in arithmetic string.c: In function `string_to_num': string.c:461: warning: pointer of type `void *' used in arithmetic cc -O2 -Wpointer-arith -I./include -DHAS_JIT -o encoding.o -c encoding.c Could I suggest that for gcc we turn on maximal bitchiness, /please/ -Wall, -W and everything even bitchier still that we can get away with. One needs to enforce such stricture early in the project, else it becomes impossible to retrofit it later. I know that turning on gcc bitchiness doesn't directly help anyone testing and committing code who is testing with any other compiler, but assuming that a reasonable proportion of people here (>50%?) are using gcc it should cause any problems to be detected fairly early. I'll also volunteer to tidy up all the current code to as many warnings I can find (but not necessarily be the one correcting things hereafter), assuming that this idea is considered worthy. > i'll see about working up a patch tomorrow, but a few questions for the > parrot code police. what is the best way to touch a file from inside of > perl? also, what is the prefered way of handling the void pointers? > casting to char*? some other typedef? change STRING::bufstart from a > void* to a char*? ...etc... utime is probably the best way to touch a file from inside perl. Nicholas Clark