[Python-Dev] Pep 353: Py_ssize_t advice
david.nospam.hopwood at blueyonder.co.uk
Sat Sep 23 22:00:29 CEST 2006
Martin v. Löwis wrote:
> David Abrahams schrieb:
>>(C++ allows restating of typedefs; if C allows it, that should be
> C also allows this; [...]
This is nitpicking, since you agreed the change to the PEP, but are you
sure that C allows this?
From C99 + TC1 + TC2 (http://www.open-std.org/JTC1/SC22/WG14/www/standards):
# 6.2.2 Linkages of identifiers
# 6 The following identifiers have no linkage: an identifier declared
# to be anything other than an object or a function; [...]
(i.e. typedef identifiers have no linkage)
# 6.7 Declarations
# 3 If an identifier has no linkage, there shall be no more than one
# declaration of the identifier (in a declarator or type specifier)
# with the same scope and in the same name space, except for tags as
# specified in 220.127.116.11.
# 18.104.22.168 Tags
# 1 A specific type shall have its content defined at most once.
(There is nothing else in 22.214.171.124 that applies to typedefs.)
Since 6.7 (3) and 126.96.36.199 (1) are constraints, I read this as saying that
a C99 implementation must produce a diagnostic if a typedef is redeclared
in the same scope. If the program is run despite the diagnostic, its behaviour
Several C compilers I've used in the past have needed the idempotence guard
on typedefs, in any case.
David Hopwood <david.nospam.hopwood at blueyonder.co.uk>
More information about the Python-Dev