Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #14652

Re: static constants are not local to the file they're defined.

From Luca Cerone <luca.cerone@gmail.com>
Newsgroups comp.lang.c++
Subject Re: static constants are not local to the file they're defined.
Date 2012-03-01 06:51 -0800
Organization http://groups.google.com
Message-ID <17386272.1266.1330613495577.JavaMail.geo-discussion-forums@vbux23> (permalink)
References <16464242.82.1330590524680.JavaMail.geo-discussion-forums@vbtf25>

Show all headers | View raw


Thanks for your replies.
Apparently I made something wrong before because creating
a minimal example to post here I could use the declared constant only
in mylib.cpp.

What I don't get though is: why should I declare it static?
If I declare a simple const double variable I get the same a variable
that is only valid in mylib.cpp and not in the other files.

What does "static" actually do when declaring a global variable in mylib.cpp?
Can you post me some code where it does make a difference using static or not?
(as global variable, I get what static does inside the scope of a function).

Thanks for your help,
Luca

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

static constants are not local to the file they're defined. Luca Cerone <luca.cerone@gmail.com> - 2012-03-01 00:28 -0800
  Re: static constants are not local to the file they're defined. Robert Wessel <robertwessel2@yahoo.com> - 2012-03-01 02:55 -0600
  Re: static constants are not local to the file they're defined. Geoff <geoff@invalid.invalid> - 2012-03-01 01:25 -0800
  Re: static constants are not local to the file they're defined. Luca Cerone <luca.cerone@gmail.com> - 2012-03-01 06:51 -0800
    Re: static constants are not local to the file they're defined. Christian Gollwitzer <auriocus@gmx.de> - 2012-03-01 19:21 +0100
    Re: static constants are not local to the file they're defined. Robert Wessel <robertwessel2@yahoo.com> - 2012-03-01 12:21 -0600
      Re: static constants are not local to the file they're defined. Luca Cerone <luca.cerone@gmail.com> - 2012-03-02 00:56 -0800
        Re: static constants are not local to the file they're defined. Robert Wessel <robertwessel2@yahoo.com> - 2012-03-02 03:53 -0600
          Re: static constants are not local to the file they're defined. Luca Cerone <luca.cerone@gmail.com> - 2012-03-02 02:42 -0800

csiph-web