On Tue, Dec 1, 2009 at 1:46 PM, "Martin v. Löwis" <mar...@v.loewis.de> wrote:
> Mark Dickinson wrote:
>> Question:  should the CPython source compile cleanly and work
>> correctly on (mostly ancient or hypothetical) machines that use
>> ones' complement or sign-and-magnitude to represent signed integers?
>
> I think that's the wrong question to ask. What you really meant to ask
> (IIUC) is this: Should CPython be allowed to invoke behavior that is
> declared undefined by the C standard, but has a clear meaning when
> assuming two's complement?

No, the original question really was the question that I meant to ask.  :)

I absolutely agree that CPython shouldn't invoke undefined behaviour,
precisely because of the risk of gcc (or some other compiler)
optimizing based on the assumption that undefined behaviour never
happens.  This is why I opened issue 7406.

So my question, and the listed assumptions, are about implementation-
defined behaviour, not undefined behaviour.  For the 3 assumptions listed,
gcc obeys all those assumptions (see section 4.5 of the GCC manual).

http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Integers-implementation.html

Personally I can't think of any good reason not to make these assumptions.

Mark
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to