question about anonymous namespace...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • peter koch

    #16
    Re: question about anonymous namespace...

    On 23 Okt., 22:52, Hendrik Schober <spamt...@gmx.d ewrote:
    James Kanze wrote:
    On Oct 23, 5:35 pm, "spamboun...@gm x.de" <spamboun...@gm x.dewrote:
    [...]
    I'd bet a horse and a carrot that "unnamed" is the literal
    meaning of "anonymous" .
    >
    Actually, no.  From the way I understand English, anonymous
    means that the name is hidden, and not visible; unnamed means
    that it doesn't exist.  In which case, anonymous is actually
    closer to what really happens.
    >
      According to my dictionary, "anonymous" derives from an old
      Latin word which derives from a Greek word, consisting of "an"
      ("without") and "onuma" ("name"), and meaning "nameless".
      I know, of course, that this leaves a lot of room for a debate
      about whether today this actually is "the literal meaning" of
      the word or not... However, my dictionary then produces "having
      an unknown or unacknowledged name" as the first of the three
      meanings it comes up with. (And now there's room for a debate
      whether my dictionary is actually worth anything...)
    >
      Schobi
    But your dictionary seems to agree with James Kanze, right? anonymous
    = unknown name, unnamed = has no name. Regarding the etymology, it is
    quite normal that the original meaning of a word changes meaning over
    time.

    /Peter

    Comment

    • Hendrik Schober

      #17
      Re: question about anonymous namespace...

      Luna Moon wrote:
      [...]
      I thought "static" means "persistent ", are the anonymous name space
      persistent?
      'static' is one of the (if not the) most overloaded keywords in
      C and C++. It means different things in different contexts.
      [...]
      Schobi

      Comment

      • James Kanze

        #18
        Re: question about anonymous namespace...

        On Oct 23, 11:21 pm, Luna Moon <lunamoonm...@g mail.comwrote:
        On Oct 22, 4:05 pm, Ian Collins <ian-n...@hotmail.co mwrote:
        I thought "static" means "persistent ", are the anonymous name
        space persistent?
        In C++, the static keyword is very overloaded. It can affect
        linkage or lifetime, or both, depending on where it is used.
        When used with a local variable, it means static lifetime, which
        corresponds more or less to the general English meaning (not to
        be confused with persistent, which is usually used to mean that
        the lifetime extends beyond the execution of the program). If
        you apply it to a function or variable at namespace scope,
        however, it means internal linkage---the opposite of extern
        (more or less: extern can also mean that the declaration is not
        a definition---the actual rules are not at all orthogonal).

        All variables declared at namespace scope have static lifetime,
        whether they are declared with the keyword static or not.
        Member variables declared with the static keyword also have
        static lifetime; without the static keyword, they have the
        lifetime of the containing object. Variables defined with
        local scope have static lifetime if defined with the static
        keyword, automatic otherwise.

        Functions don't have lifetime, in the sense C++ defines it;
        they're just there.
        If you define "static" in a function, it will only get
        initialized once and can be used forever...
        Not forever. Only until the end of the program. A persistent
        variable could be used forever, but there is no direct support
        for this in the language; you have to implement it yourself.

        --
        James Kanze (GABI Software) email:james.kan ze@gmail.com
        Conseils en informatique orientée objet/
        Beratung in objektorientier ter Datenverarbeitu ng
        9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

        Comment

        • James Kanze

          #19
          Re: question about anonymous namespace...

          On Oct 24, 12:13 am, peter koch <peter.koch.lar ...@gmail.comwr ote:
          On 23 Okt., 22:52, Hendrik Schober <spamt...@gmx.d ewrote:
          James Kanze wrote:
          On Oct 23, 5:35 pm, "spamboun...@gm x.de" <spamboun...@gm x.dewrote:
          [...]
          >I'd bet a horse and a carrot that "unnamed" is the
          >literal meaning of "anonymous" .
          Actually, no. From the way I understand English,
          anonymous means that the name is hidden, and not visible;
          unnamed means that it doesn't exist. In which case,
          anonymous is actually closer to what really happens.
          According to my dictionary, "anonymous" derives from an
          old Latin word which derives from a Greek word, consisting
          of "an" ("without") and "onuma" ("name"), and meaning
          "nameless". I know, of course, that this leaves a lot of
          room for a debate about whether today this actually is
          "the literal meaning" of the word or not... However, my
          dictionary then produces "having an unknown or
          unacknowledged name" as the first of the three meanings it
          comes up with. (And now there's room for a debate whether
          my dictionary is actually worth anything...)
          But your dictionary seems to agree with James Kanze, right?
          anonymous = unknown name, unnamed = has no name. Regarding the
          etymology, it is quite normal that the original meaning of a
          word changes meaning over time.
          In everyday English, words can also be a bit ambiguous. I'm
          pretty sure that a native English speaker would "feel" a
          difference (at least a nuace of a difference) between anonymous
          and unnamed, but there is also some overlap in the meanings. In
          technical fields, we then specialize the meaning, so that it is
          exact.

          I did a quick find on the standard; all uses of anonymous were
          for anonymous unions or anonymous bit fields, so Hendrik is
          probably right that we should be talking about unnamed unions.
          Regardless of the appropriateness of the term, based on its
          natural English use, it's the formal term used in the standard.
          Or "we should have been talking about unnamed namespace":
          regardless of the standard terminology, "anonymous namespace"
          has been adopted by the technical experts to describe this
          feature, and is widely understood and used; in this specialized,
          technical sense, anonymous and unnamed are exact synonyms, and
          you can pretty much use them interchangeably without causing
          problems of understanding.

          --
          James Kanze (GABI Software) email:james.kan ze@gmail.com
          Conseils en informatique orientée objet/
          Beratung in objektorientier ter Datenverarbeitu ng
          9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

          Comment

          • spambouncer@gmx.de

            #20
            Re: question about anonymous namespace...

            On 24 Okt., 09:36, James Kanze <james.ka...@gm ail.comwrote:
            ...
            regardless of the standard terminology, "anonymous namespace"
            has been adopted by the technical experts to describe this
            feature, and is widely understood and used; in this specialized,
            technical sense, anonymous and unnamed are exact synonyms, and
            you can pretty much use them interchangeably without causing
            problems of understanding.
            There you go. Geez, people! What a debate! My betting a horse was
            supposed to end the nitpicking. It wasn't a real horse, see. There
            wasn't the slightest ambiguity to begin with. Everyone knew exactly
            what we were talking about.

            Ok, who wants the carrot?

            Comment

            • Pete Becker

              #21
              Re: question about anonymous namespace...

              On 2008-10-24 04:20:39 -0400, "spambouncer@gm x.de" <spambouncer@gm x.desaid:
              On 24 Okt., 09:36, James Kanze <james.ka...@gm ail.comwrote:
              >...
              >regardless of the standard terminology, "anonymous namespace"
              >has been adopted by the technical experts to describe this
              >feature, and is widely understood and used; in this specialized,
              >technical sense, anonymous and unnamed are exact synonyms, and
              >you can pretty much use them interchangeably without causing
              >problems of understanding.
              >
              There you go. Geez, people! What a debate! My betting a horse was
              supposed to end the nitpicking. It wasn't a real horse, see.
              Indeed. It didn't even have a name.

              --
              Pete
              Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
              Standard C++ Library Extensions: a Tutorial and Reference
              (www.petebecker.com/tr1book)

              Comment

              • Jeff Schwab

                #22
                Re: question about anonymous namespace...

                Pete Becker wrote:
                On 2008-10-24 04:20:39 -0400, "spambouncer@gm x.de" <spambouncer@gm x.de>
                said:
                >
                >On 24 Okt., 09:36, James Kanze <james.ka...@gm ail.comwrote:
                >>...
                >>regardless of the standard terminology, "anonymous namespace"
                >>has been adopted by the technical experts to describe this
                >>feature, and is widely understood and used; in this specialized,
                >>technical sense, anonymous and unnamed are exact synonyms, and
                >>you can pretty much use them interchangeably without causing
                >>problems of understanding.
                >>
                >There you go. Geez, people! What a debate! My betting a horse was
                >supposed to end the nitpicking. It wasn't a real horse, see.
                >
                Indeed. It didn't even have a name.
                That took me a minute.

                Anyway, don't knock it 'till you try it. You see, I've been through the
                desert on a horse with no name. (In the desert, you forget your name,
                so I guess the horse was really more "anonymous" than "unnamed.")

                Comment

                • Gennaro Prota

                  #23
                  Re: question about anonymous namespace...

                  James Kanze wrote:
                  [...]
                  >But your dictionary seems to agree with James Kanze, right?
                  >anonymous = unknown name, unnamed = has no name. Regarding the
                  >etymology, it is quite normal that the original meaning of a
                  >word changes meaning over time.
                  >
                  In everyday English, words can also be a bit ambiguous. I'm
                  pretty sure that a native English speaker would "feel" a
                  difference (at least a nuace of a difference) between anonymous
                  and unnamed, but there is also some overlap in the meanings. In
                  technical fields, we then specialize the meaning, so that it is
                  exact.
                  FWIW, I feel the difference, too. However I can see "unnamed" as
                  deriving either from the substantive "name" or the verb "to
                  name", in which case it sound as "is not named". And my mind
                  leans towards the latter meaning when I add "nameless" to the
                  mix :-)

                  --
                  Gennaro Prota | name.surname yahoo.com
                  Breeze C++ (preview): <https://sourceforge.net/projects/breeze/>
                  Do you need expertise in C++? I'm available.

                  Comment

                  Working...