[mpich-discuss] robust-ifying MPI_File_seek and negative offsets

Jed Brown jedbrown at mcs.anl.gov
Fri Apr 13 16:41:48 CDT 2012


On Fri, Apr 13, 2012 at 14:29, Dave Goodell <goodell at mcs.anl.gov> wrote:

> On Apr 13, 2012, at 7:58 AM CDT, Jed Brown wrote:
>
> > unary - is applied to an unsigned type, producing an unsigned result.
> The actual value is implementation defined, but most/all compilers on twos
> complement systems will insert a normal signed negation instruction (NEG on
> Intel).
>
> I don't disagree with most of your analysis, but isn't the unsigned result
> well defined by other parts of the standard?  Doesn't it have to be done in
> terms of modulo arithmetic (irrespective of whether 2's complement, 1's
> complement, or sign and magnitude representations are used)?  So the
> resulting unsigned value of "-(size_t)4" has to be "SIZE_MAX+1-4", right?
>
> Relevant C/C++ standards sections and similar rationale here:
> http://stackoverflow.com/a/1269049/158513


Thanks for pointing this out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20120413/f252de86/attachment.htm>


More information about the mpich-discuss mailing list