CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 3 FirstFirst 123
Results 31 to 32 of 32
  1. #31
    Join Date
    May 2018
    Posts
    158

    Re: using namespace std

    Thank you all for great explanations and suggestions.

  2. #32
    Join Date
    Feb 2017
    Posts
    677

    Re: using namespace std

    One aspect of namespaces is that it's a good idea to introduce your own namespaces in your programs. You sub-divide your program into namespaces where each namespace contains code that naturally belong together. Best is to not use using at all but instead qualify each symbol/name with its namespace. In this way you avoid name clashes and it's immediately obvious where a certain symbol/name originates in your own code as well as in code by others such as the standard library.

    Also note that the splitting of C++ programs into .h and .cpp files is a convention and not stipulated by the C++ language. Unfortunately this practice is still upheld in most schools so after a C++ newbie course students usually come away with the impression that .h/.cpp splitting is essential to C++ when today the trend is rather the opposite. One example is the increasing number of third-party libraries consisting of .h files only.

    Bjarne Stroustrup has said that C++ 11 feels like new language with a more high-level style of programming (rather than struggling with copy constructors and assignment operators to manage low-level memory for example). It will be interesting to see whether/how this is reflected in the second edition of his book "A Tour of C++" due on June 29.
    Last edited by wolle; June 13th, 2018 at 02:26 AM.

Page 3 of 3 FirstFirst 123

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured