On Friday, May 26, 2017 at 5:31:54 PM UTC+5:30, Chris Angelico wrote: > On Fri, May 26, 2017 at 9:46 PM, Steve D'Aprano wrote: > > > >> And yes, Steve, this is a challenge to you: if you think C's undefined > >> behaviour is an abomination that should not be allowed to exist, > > > > CPython doesn't have to define the behaviour here. In *that* sense, the > > ordinary, regular sense, it is undefined. The implication of that is that > > whatever happens will happen according to some deterministic but > > unpredictable (to you, the developer, at least) chain of cause and effect > > that depends on the implementation. Probably something bad. > > > > That's fine. The Python language does not have to define the behaviour of > > programs which abuse ctypes like that. If you do so, then whatever happens > > will happen. > > > > That's not how the C standard defines "undefined behaviour", or the > > implication of such. > > Can you explain to me how it's different? Either way, the > implementation is allowed to do what it likes, because you shouldn't > be doing that.
I am guessing that Steven is mixing up undefined and unspecified behavior Undefined : Implementation can do whatever it likes; erroring out or not Unspecified : | use of an unspecified value, or other behavior where this International Standard | provides two or more possibilities and imposes no further requirements on which | is chosen in any instance -- https://mail.python.org/mailman/listinfo/python-list