Mail Archives: djgpp-workers/2001/08/06/17:12:14
Hello.
Hans-Bernhard Broeker wrote:
>
> On Sat, 4 Aug 2001, Richard Dawe wrote:
[snip]
> > This cast does not work. This seems strange - I would expect a cast
> > from signed long to unsigned long long to work. Wouldn't the value be
> > zero-extended to fill the unsigned long long?
>
> Iff it's negative: no. It'll be sign-extended.
[snip]
> Reference: K&R2, Appendix A.6.2 on "Integer Conversion".
Thanks, I thought K&R would have the answer. It usually does.
> > material here.) Typecasting to unsigned long then uintmax_t seems to
> > work, but I think that's a hack rather than the solution.
>
> A proper solution would only be to make st_size (unsigned) long long, of
> course...
Or perhaps put a configure test in to detect the size of off_t and then
cast to an unsigned integer with the same size, as suggested by Jim
Meyering (the Fileutils maintainer). He's not very keen on this idea
though, so I may end up just including a fix in the patches for the DJGPP
port.
Bye, Rich =]
--
Richard Dawe
http://www.phekda.freeserve.co.uk/richdawe/
- Raw text -