Deprecated C ++ code does not contain std :: prefix

I am working on compiling a very old piece of legacy code with g ++ 4.4.7. All I really know about this code is that it was developed on the Irix / Sun system, which means it has MIPS architecture. One is a strange thing I discovered while working with this code, is that sometimes it is a function of type endland set_new_handlerwithout the prefix std::. Obviously, this leads to a compilation error. Since I work on the assumption that this piece of code was compiled on some machine at some point, I am a little afraid that I blindly add a prefix std::so that it compiles, as it may change the behavior.

So, is there some old non-ISO compiler that allows you to compile this piece of code? Or is there some kind of flag that I can pass to gcc that will allow me to work with this piece of code?

+4
source share
1 answer

The namespace was stdnot introduced in C ++ until the first ISO / IEC standard in 1998 (often called C ++ 98). Until that time, all standard library functions and objects were part of the global namespace.

Herb Sutter wrote a snippet entitled Migrating to the Namespace in 2000, which detailed his advice on the transition.

- , std , , - std , , . . " std" ?

, 1998 , . , using , , . , .

using std::endl;
using std::set_new_handler;

, - . - std:: .

+2

Source: https://habr.com/ru/post/1691237/


All Articles