digitalmars.D.learn - Q: (dmd 1.x) Difference between 'static const ...' and 'const ...'
- Myron Alexander (5/8) Jun 25 2007 Is there any difference between 'static const ...' and 'const ...'?
- BCS (3/16) Jun 25 2007 I may be wrong but, unless you use it as a mixin or inside of a class/st...
- Kirk McDonald (10/30) Jun 25 2007 More generally: Using 'static' at module-level scope does nothing. If
- Myron Alexander (3/30) Jun 25 2007 Thanks all.
Hello. For DMD 1.x, let's say I have the following template:template structname (S) { static const string structname = S.stringof[0..$-1]; }Is there any difference between 'static const ...' and 'const ...'? Thanks. Myron.
Jun 25 2007
Reply to Myron,Hello. For DMD 1.x, let's say I have the following template:I may be wrong but, unless you use it as a mixin or inside of a class/struct, I don't think so.template structname (S) { static const string structname = S.stringof[0..$-1]; }Is there any difference between 'static const ...' and 'const ...'? Thanks. Myron.
Jun 25 2007
BCS wrote:Reply to Myron,More generally: Using 'static' at module-level scope does nothing. If the actual declaration ends up at some other scope (whether the template was mixed-in or is simply located somewhere other than module scope) then the 'static' will be meaningful. -- Kirk McDonald http://kirkmcdonald.blogspot.com Pyd: Connecting D and Python http://pyd.dsource.orgHello. For DMD 1.x, let's say I have the following template:I may be wrong but, unless you use it as a mixin or inside of a class/struct, I don't think so.template structname (S) { static const string structname = S.stringof[0..$-1]; }Is there any difference between 'static const ...' and 'const ...'? Thanks. Myron.
Jun 25 2007
Kirk McDonald wrote:BCS wrote:Thanks all. Myron.Reply to Myron,More generally: Using 'static' at module-level scope does nothing. If the actual declaration ends up at some other scope (whether the template was mixed-in or is simply located somewhere other than module scope) then the 'static' will be meaningful.Hello. For DMD 1.x, let's say I have the following template:I may be wrong but, unless you use it as a mixin or inside of a class/struct, I don't think so.template structname (S) { static const string structname = S.stringof[0..$-1]; }Is there any difference between 'static const ...' and 'const ...'? Thanks. Myron.
Jun 25 2007