Are the critiques in "All the things I hate about Python" valid?

Alain Ketterlin alain at universite-de-strasbourg.fr.invalid
Mon Feb 19 05:43:11 EST 2018


Chris Angelico <rosuav at gmail.com> writes:

> On Mon, Feb 19, 2018 at 9:04 PM, Alain Ketterlin
> <alain at universite-de-strasbourg.fr.invalid> wrote:

>> Look at the C11 standard, section 6.3.2.3 ("Pointers"), 6.5.§6-7
>> ("effective types"), and 6.5.3.2 ("Address and indirection operators").
>> It is tiring to constantly correct misunderstandings about pointer
>> casting and dereferencing.
>>
>>> $ cat demo.c; gcc -Wall demo.c; ./a.out
>> [...]
>>
>> If you don't know what undefined behavior is, better avoid C. Your
>> program has UB, anything can happen, including a seemingly sensible
>> result.
>
> Sure it can. But I don't know what you can mean by "stronger rules" if
> all it says is "that's undefined". Saying that behaviour is undefined
> does NOT mean that C has a stronger type system. I got no errors, not
> even a warning in -Wall mode, so there is no indication that my code
> did something wrong.

I used "stronger rules" in response to the OP claim ("C lets you
manipulate memory freely"). Undefined behavior is part of the semantics
of C, the same way infinite loops of signed-integer overflow are. What
compilers can do about it is a different matter. This is well
documented, those that want to ignore UB are on their own. Anyway, I
think it is irrelevant here. Search for "What every programmer should
know about undefined behavior" if you are interested.

-- Alain.



More information about the Python-list mailing list