Python is DOOMED! Again!

Devin Jeanpierre jeanpierreda at gmail.com
Sun Feb 1 11:54:42 EST 2015


On Sun, Feb 1, 2015 at 8:34 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Devin Jeanpierre wrote:
>
>> It's really only dynamically typed languages that have a single null
>> value of a single type. Maybe I misunderstand the original statement.
>
> Pascal is statically typed and has a single null pointer compatible with all
> pointer types. C has a single nil pointer compatible with all pointer
> types. I expect that the Modula and Oberon family of languages copied
> Pascal, which probably copied Algol.

No, C has a NULL macro which evaluates to something which coerces to
any pointer type and will be the null value of that type. But there's
one null value per type. The C standard makes no guarantees that they
are compatible in any way, e.g. they can be of different sizes. On
some systems, the null function pointer will have a size of N, where
the null int pointer will have a size of M, where N != M -- so these
are clearly not the same null value.

I don't know Pascal, but I wouldn't be surprised if something similar
held, as nonuniform pointer sizes were a thing once.

-- Devin



More information about the Python-list mailing list