On Sun, Feb 1, 2015 at 8:34 AM, Steven D'Aprano
<steve+comp.lang.pyt...@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
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to