c++ - How important is consistent usage of using declarations? -


Most research done on the use of announcements, including reading relevant sections of different style guides, shows that Whether or not to use announcements in C ++ source files, as long as they appear after all #includes, this is a decision that has been left for the coder even the style guides I have read , Which is usually on one side or another Knowledge disputes comes down to consistency, are quite flexible in this regard.

My question is, how important is it to use high level of flexibility, using a consistent style? For example, suppose an author has written something using

  std :: vector; The vector & lt; T & gt; V; Std :: cout & lt; & Lt; V [0] & lt; & Lt; Std :: endl;  

Is the incompatible application to use on std :: cout or std :: endl on std :: vector generally acceptable, or will it be considered undisciplined?

I think using is that you have between names Use it inconsistently. Names that are needed in some blocks can be declared locally, while others are not. I do not see any problem with that.

To name the namespace is always difficult to declare a name. I think that if the name is clearly related to a specific place name , So that it will not be confused with other namespaces, it will not hurt the declaration used to make your code more readable.


Comments