C ++ Standard:
7.1.1 / 6: "A name declared in a namespace area without a storage class specifier is external if it has an internal relationship due to a previous declaration" [or if it is not const].
In your first case, name declared in the namespace area (in particular, in the global namespace). Therefore, the first declaration changes the relationship of the second declaration.
Reverse ban because:
7.1.1 / 7: "Communications implied by successive announcements for a given entity agrees."
So, in the second example, the first declaration has an external link (according to 7.1.1 / 6), and the second has an internal link (explicitly), and this is not consistent.
You are also asking about C, and I think this is the same. But I have a C ++ book right here, while you are just as capable of looking at a draft standard C project as I am ,-)
Steve jessop
source share