From: http://blog.shuwo.org/archives/305/
Using namespace STD meaning:Both using and namespace are keywords of C ++.STD is the name of the namespace in which the standard library is located.If the boost library is used, write using namespace
Transmittal of the original text: I don ' t want to see another "using namespace xxx;" header file ever againTransfer from http://blog.csdn.net/pleasecallmewhy/article/details/8528702Here, I have said this without a shy word.As a developer/team
1, and In your compiler include folder you can see that the two are two files, inside the code is not the same.The header file with the suffix. h C + + standard has been explicitly not supported, the earlier implementation of the standard library
Here, I say this without a word:
Reference I never want to see "using namespace xxx" in any header file. Had
As a developer/team leader, I often recruit new project members and sometimes help other groups to interview candidates. As one of the
Original article: I don't want to see another "Using namespace xxx;" in a header file ever again
Here, I did not shy away from this sentence.
As a developer/Team Leader, I often recruit new project members and sometimes help people in other groups
Using namespace STD; many of them are used!---------------------------------------------------------------
Actually, it is to tell the compiler where to find your type.
Using namespace STD is commonly used, that is, the standard namespace of C ++
I've been looking at the C + + language programming (third edition) written by Ms. Lv, published by the University of Electronics, and I didn't know there was a flaw in the program code, and I was immersed in his book and didn't go to see the other
Using namespace you will find that there are more than n articles, but basically it is the article that is constantly reposted. I don't think it is very clear, so everyone can understand it, prevent name conflicts...
The usage of custom namespaces
For a C + + console program that has standard input output, a sentence is typically found on the next line of # include , using namespace Std. In fact, all of the standard library functions are defined in standard namespace Std. Its role is to avoid
In a managed C ++ project, we can use the "Using namespace" expression to include managed types. just like using "# include" incorrectly will cause some compile error, declaring "Using namespace" globally will cause some problems too. we encountered
Error: The global variable is not clear (the using namespace std conflicts with the global variable), namespacestd
When writing the eight queens recursively, a global variable count is defined. The following error occurs:Unknown global variables.
If you want to ask me what is the worst habit I found in C ++?
I have to tell you: it is the habit of using namespace STD;
Sometimes you will find that using namespace STD can save you a lot of time to avoid STD: cout; STD: CIN; STD: Endl, STD:
Recently, we have just started reading the C + + textbook. found that they did not learn seriously, a lot of things pointed to the present only to understand. (Orz, ashamed)I no longer want to see "using namespace xxx;" In any header file. TheBaidu
The following is a detailed analysis of the use of the using namespace Std in C + +, the need for friends can come to refer to the next
One: and are not the same, the former has no suffix, in fact, in your compiler include folder you can see that
I:
and It is different. The former has no suffix. In fact, you can see in the include folder of your compiler that the two are two files. When you open the file, you will find that the code inside is different.
Suffix. h header file c ++ standards
If you need to use the C + + input (CIN) or output (cout) tool in your program, you must provide two lines of code:1 #include 2usingnamespace//can use the space name for something inside STDThis code appears when I build a C + + project called
The so-called namespace refers to the various visible ranges of identifiers. All identifiers in the C + + standard library are defined in a namespace called Std.
One:
and are not the same, the former has no suffix, in fact, in your compiler
One: and are not the same, the former has no suffix, in fact, in your compiler include folder you can see that the two are two files, open the file will find that the code inside is not the same.
The C + + standard for the header file suffix. h
Using the STD namespaceThe C + + language after 98 provides a global namespace namespace that avoids the problem of causing global naming conflicts. To cite an instance, note the following two header files:One.hchar func (char);Class String
Using namespace std STD is a namespace ..Different namespaces can have the same class name defined ..Using namespace STD;Indicates that the following program uses STD. If this statement is not used, use STD: string (string is defined in the STD
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.