[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: POSIX, alpha, strtok() and char *'s...



> 
> 
> my question regards POSIX saying that strtok returns a char *.
> 
> on my axp, sizeof(char *) = 8
> 
> sizeof(strtok(configToken, \",\")) is 4 (!)

Are you sure that you included a header file and that compiling
with -Wall does not come up with any warnings?  Undeclared types
default in C to int (sizeof(int) is four on Alpha).

Your result is typical for a buggy coding which trips so many
on Alpha 

> hence, sizeof((char *)strtok(configToken, ",")) = cast to pointer from
>                                                   integer of different
>                                                   size

for reasons you state so clearly.  You can get away with something
like that on Intel.

I cannot check it right now but I have a strong suspicion that
your C is not correct.  Or you found a true bug in headers.

  Michal



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []