Static and namespace

This is a discussion on Static and namespace within the C++ Programming forums, part of the General Programming Boards category; If I replace static int count; with Code: namespace { int count; } does this have the same meaning scopewise ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    41

    Static and namespace

    If I replace
    static int count;

    with
    Code:
    namespace
    {
     int count;
    }
    does this have the same meaning scopewise and memorywise?

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Yes; the former is a deprecated use of the static keyword, i.e. you should prefer the anonymous namespace.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. uploading file to http server via multipart form data
    By Dynamo in forum C++ Programming
    Replies: 1
    Last Post: 09-03-2008, 05:36 AM
  2. Using static libraries
    By steve1_rm in forum C++ Programming
    Replies: 5
    Last Post: 02-29-2008, 11:40 PM
  3. namespace does not exist
    By scott27349 in forum C++ Programming
    Replies: 5
    Last Post: 04-18-2003, 09:48 PM
  4. Undefined Error
    By peking1983 in forum C++ Programming
    Replies: 1
    Last Post: 03-11-2003, 03:55 PM
  5. Static Members...
    By BigDaddyDrew in forum C++ Programming
    Replies: 2
    Last Post: 02-11-2003, 08:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21