Thread: questions about static function & static const variable

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User cph's Avatar
    Join Date
    Sep 2008
    Location
    Indonesia
    Posts
    86

    questions about static function & static const variable

    I have some questions (actually two) that really bugging me for a long time.

    question #1:
    why are some functions declared static?
    what is the effect of declaring a function static?
    Code:
    static void foo (void)
    {
      /* blah blah blah... */
    }
    question #2:
    is this function thread safe?
    Code:
    int foo (int bar)
    {
      static const int a_static_const_int = 100;
      int foobar;
    
      /* blah blah blah... */
    
      return(foobar);
    }
    thank you for your attention.
    Last edited by cph; 01-19-2009 at 01:08 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 01:22 PM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  4. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM
  5. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM