[Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification

"Martin v. Löwis" martin at v.loewis.de
Sat Feb 11 09:30:52 CET 2006


Greg Ewing wrote:
>>FWIW, Annex D also defines these features as deprecated:
>>- the use of "static" for objects in namespace scope (AFAICT
>>  including C file-level static variables and functions)
>>- C library headers (i.e. <stdio.h>)
> 
> 
> Things like this are really starting to get on my groat.
> It used to be that C++ was very nearly a superset of C,
> so it was easy to write code that would compile as either.
> But C++ seems to be evolving into a different language
> altogether.

Not at all. People appear to completely fail to grasp
the notion of "deprecated" in this context. It just
means "it may go away in a future version", implying
that the rest of it may *not* go away in a future
version.

That future version might get published in 2270,
when everybody has switched to C++, and compatibility
with C is no longer required.

So the compiler is wrong for warning about it (or
the user is wrong for asking to get warned), and
you are wrong for getting upset about this.

> (And an obnoxiously authoritarian one at that. If I want
> to write some C++ code that uses stdio because I happen
> to like it better, why the heck shouldn't I be allowed
> to? It's MY program, not the C++ standards board's!)

Again, you are misunderstanding what precisely is
deprecated. Sure you can still use stdio, and it is
never going away (it isn't deprecated). However, you
have to spell the header as

#include <cstdio>

and then refer to the functions as std::printf,
std::stderr, etc.

What is really being deprecated here is the global
namespace. That's also the reason to deprecate
file-level static: you should use anonymous namespaces
instead.

(Also, just in case this is misunderstood again:
it is *not* that programs cannot put stuff in
the global namespace anymore. It's just that the
standard library should not put stuff in the
global namespace).

Regards,
Martin


More information about the Python-Dev mailing list