🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3670

No way to define some extern consts?

#3670
From: scott douglass
Date: Thu, 14 Mar 1996 16:17
25 lines
1443 bytes
Hello all,

Given a class type with only a no-argument contstrutor:

struct T { T(); /* ... */ };  // assume no other ctors

Is there any way to define an extern const object of class T?

extern const T t; // nope:  this is a declaration
const T t2; // nope:  this is a definition, but t2 is not extern
extern const T t3();  // nope:  this is a declaration of the function
named t3 which returns a const T

So, can you find a way to *define* an extern const object type T? 
(Besides adding some ctor with a dummy argument.)  If you can you9re
smarter than I am.

Thanks,
    --scott
---
[ 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         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Technical Details
Message-ID: <sdouglas-1403961511440001@193.131.176.202>
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back

Show Full Headers
Complete Article Headers
From: sdouglas@armltd.co.uk (scott douglass)
Message-ID: <sdouglas-1403961511440001@193.131.176.202>
X-Original-Date: Thu, 14 Mar 1996 15:11:44 +0000
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
Date: 14 Mar 96 16:17:59 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
Subject: No way to define some extern consts?
Organization: Apple Computer, Inc.
X-Newsreader: Yet Another NewsWatcher 2.0.2
X-Auth: PGPMoose V1.1 PGP comp.std.c++