g77-alpha binary file BACKSPACE does not work

Richard Henderson rth@cygnus.com
Thu Jan 15 22:28:00 GMT 1998


In article <9801152109.AA09566.cygnus.egcs.bugs@moene.indiv.nluug.nl>,
Toon Moene <toon@moene.indiv.nluug.nl> wrote:
>48    {       (void) fseek(b->ufd,-(long)sizeof(int),SEEK_CUR);
>49            (void) fread((char *)&n,sizeof(int),1,b->ufd);
>50            (void) fseek(b->ufd,-(long)n-2*sizeof(int),SEEK_CUR);
>
>Note that n == 0, and therefore the "seek back" isn't effective.   
>Could someone with more experience on Linux/Alpha join in to tell us  
>the exact argument signature of fseek, as I suspect that the cast  
>to long (64-bits on Alpha) might be wrong ...

extern int fseek(FILE* fp, long int offset, int whence);

But that shouldn't matter with small numbers, since they are always
sign extended to 64 bits across the function call anyway.

What I don't understand is the semantics of `backspace'.  From this
code we are backing up a number of bytes proportional to the last
integer written to the file.  This makes no sense to me.


r~



More information about the Gcc-bugs mailing list