Topic: Order of initialisation for template class statics


Author: Francis Glassborow <francis.glassborow@ntlworld.com>
Date: Wed, 7 Feb 2001 15:51:11 GMT
Raw View
A question has just been raised on comp.lang.c++.moderated wrt static
members of template classes.

If an instantiation of template class is used in several translation
units, where and when are static data members initialised?

--
Francis Glassborow
See http://www.accu.org for details of The ACCU Spring Conference, 2001
(includes many regular participants to C & C++ newsgroups)

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: Jim Hyslop <jim.hyslop@leitch.com>
Date: Wed, 7 Feb 2001 23:32:31 GMT
Raw View
In article <knlsVGBQsUg6EwXW@ntlworld.com>,
  Francis Glassborow <francisG@robinton.demon.co.uk> wrote:
> A question has just been raised on comp.lang.c++.moderated wrt static
> members of template classes.
>
> If an instantiation of template class is used in several translation
> units, where and when are static data members initialised?
Good question! I didn't see anything in clause 14 that addressed this
issue.

If that is the case, then I would *expect* that it would follow the
normal rules of static initialization, i.e. in the order of definition
within the translation unit. As to *which* translation unit it "belongs"
in, I would say it is implementation-specific.

--
Jim
To suppress Deja's product links, add this header:
x-no-productlinks: yes


Sent via Deja.com
http://www.deja.com/

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: "Andrei Iltchenko" <iltchenko@yahoo.com>
Date: Thu, 8 Feb 2001 07:05:49 GMT
Raw View
It's a bit surprising to me, as I raised this same question on this news
group on 22-Nov-2000, the posting was named "Static data members
of class templates initialization", and there was no follow-up of value.

Regards,

Andrei Iltchenko
Brainbench MVP for C++
http://www.brainbench.com



---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: Jim Hyslop <jim.hyslop@leitch.com>
Date: Thu, 8 Feb 2001 07:05:38 GMT
Raw View
In article <knlsVGBQsUg6EwXW@ntlworld.com>,
  Francis Glassborow <francisG@robinton.demon.co.uk> wrote:
> A question has just been raised on comp.lang.c++.moderated wrt static
> members of template classes.
>
> If an instantiation of template class is used in several translation
> units, where and when are static data members initialised?
Good question! I didn't see anything in clause 14 that addressed this
issue.

If that is the case, then I would *expect* that it would follow the
normal rules of static initialization, i.e. in the order of definition
within the translation unit. As to *which* translation unit it "belongs"
in, I would say it is implementation-specific.

--
Jim
To suppress Deja's product links, add this header:
x-no-productlinks: yes


Sent via Deja.com
http://www.deja.com/

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: Francis Glassborow <francis.glassborow@ntlworld.com>
Date: Thu, 8 Feb 2001 15:09:47 GMT
Raw View
In article <95sr5t$innh2$1@ID-62495.news.dfncis.de>, Andrei Iltchenko
<iltchenko@yahoo.com> writes
>It's a bit surprising to me, as I raised this same question on this news
>group on 22-Nov-2000, the posting was named "Static data members
>of class templates initialization", and there was no follow-up of value.

OK, can the moderator treat my original posting as a defect report and
get it added to the core issues list.


--
Francis Glassborow
See http://www.accu.org for details of The ACCU Spring Conference, 2001
(includes many regular participants to C & C++ newsgroups)

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: fjh@cs.mu.OZ.AU (Fergus Henderson)
Date: Thu, 8 Feb 2001 18:26:10 GMT
Raw View
Francis Glassborow <francis.glassborow@ntlworld.com> writes:

>In article <95sr5t$innh2$1@ID-62495.news.dfncis.de>, Andrei Iltchenko
><iltchenko@yahoo.com> writes
>>It's a bit surprising to me, as I raised this same question on this news
>>group on 22-Nov-2000, the posting was named "Static data members
>>of class templates initialization", and there was no follow-up of value.
>
>OK, can the moderator treat my original posting as a defect report and
>get it added to the core issues list.

Our policy is to reject defect reports which don't meet the
requirements listed below.  Your original post doesn't meet those
requirements.  In particular it should list the section numbers and
mnemonics for the relevant sections of the standard.

Requirements for defect reports:

0. A DR is not a request for an extension or a suggestion for a
   change. It reports an apparent error, inconsistency, ambiguity,
   or omission in the published final standard.
   Examples:
    - misspelled word or grammatical error
    - says "red" in one place, "blue" in another
    - says green if non-positive, brown if non-negative
    - gives no semantics if x<0
1. Sender first reviews the issues lists on the committee web site
   to be sure an equivalent DR has not already been submitted.
2. Subject line begins with "Defect Report:".
3. Message contains only one DR on one topic.
4. Message identifies all relevent sections in the final published
   standard by section number and by mnemonic. Example:
   17.4.1.2 [lib.headers]

--
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: Francis Glassborow <francis.glassborow@ntlworld.com>
Date: Fri, 9 Feb 2001 16:05:49 GMT
Raw View
In article <95ujje$27v$1@mulga.cs.mu.OZ.AU>, Fergus Henderson
<fjh@cs.mu.OZ.AU> writes
>Our policy is to reject defect reports which don't meet the
>requirements listed below.  Your original post doesn't meet those
>requirements.  In particular it should list the section numbers and
>mnemonics for the relevant sections of the standard.
 I was just being lazy:) Because, as you know, I can raise the issue
myself. I just did not want it to get lost again.

--
Francis Glassborow
See http://www.accu.org for details of The ACCU Spring Conference, 2001
(includes many regular participants to C & C++ newsgroups)

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]