const cleanup... where do consts in namespaces go

2004-01-02 Thread Kuba Ober
Hi,

I was thinking of doing some general const cleanup in the (probably very few) 
places that may need it (if any at all). I'm thinking of it w/o looking at 
the code yet (just downloaded from CVS) so please forgive if it doesn't 
directly apply.

What's the general karma of having something like

const int blah = 123;

in a header file, inside a namespace (or not)? As far as I take it, it's a 
declaration and definition in one. So, if the header is included in multiple 
modules, will the constant be replicated (defined) in the object files of all 
those modules? That would seem like a waste of space... Especially if the 
constant would be a large array.

I'm in the new year cleanup mood and I thought I could do a couple of 
trivial things just for fun :)

Cheers, Kuba Ober



Re: const cleanup... where do consts in namespaces go

2004-01-02 Thread Lars Gullik Bjønnes
Kuba Ober [EMAIL PROTECTED] writes:

| Hi,

| I was thinking of doing some general const cleanup in the (probably very few) 
| places that may need it (if any at all). I'm thinking of it w/o looking at 
| the code yet (just downloaded from CVS) so please forgive if it doesn't 
| directly apply.

| What's the general karma of having something like

| const int blah = 123;

| in a header file, inside a namespace (or not)? As far as I take it,
| it's a 

Do we have those in header files?

that is not good.

and if we had them it should be

int const blah = 123;

and it would still be bad.
 
-- 
Lgb


Re: const cleanup... where do consts in namespaces go

2004-01-02 Thread Kuba Ober
 | What's the general karma of having something like
 |
 | const int blah = 123;
 |
 | in a header file, inside a namespace (or not)? As far as I take it,
 | it's a

 Do we have those in header files?
 that is not good.
 and if we had them it should be
 int const blah = 123;
 and it would still be bad.

Is there a practical difference between const int var and int const var ? 
Consider me dumb :(

So, if there are constants that need to be made accessible to users of say 
given class, what's the best way to expose them? If int const blah = 123 is 
not the way, then what would be the way?

I don't know whether LyX has those in header files yet, I'm just building a 
list of things to go over quickly.

Kuba



Re: const cleanup... where do consts in namespaces go

2004-01-02 Thread Lars Gullik Bjønnes
Kuba Ober [EMAIL PROTECTED] writes:

 | What's the general karma of having something like
 |
 | const int blah = 123;
 |
 | in a header file, inside a namespace (or not)? As far as I take it,
 | it's a

 Do we have those in header files?
 that is not good.
 and if we had them it should be
 int const blah = 123;
 and it would still be bad.

| Is there a practical difference between const int var and int const var ? 
| Consider me dumb :(

Yes :-) Consistency.

extern int const blah; // in the header file

int const blah = 123; // in the source file

-- 
Lgb



Re: const cleanup... where do consts in namespaces go

2004-01-02 Thread Kuba Ober
 | Is there a practical difference between const int var and int const var ?
 | Consider me dumb :(

 Yes :-) Consistency.

 extern int const blah; // in the header file

 int const blah = 123; // in the source file

OK, gotcha. Thanks.

Kuba



const cleanup... where do consts in namespaces go

2004-01-02 Thread Kuba Ober
Hi,

I was thinking of doing some general const cleanup in the (probably very few) 
places that may need it (if any at all). I'm thinking of it w/o looking at 
the code yet (just downloaded from CVS) so please forgive if it doesn't 
directly apply.

What's the general karma of having something like

const int blah = 123;

in a header file, inside a namespace (or not)? As far as I take it, it's a 
declaration and definition in one. So, if the header is included in multiple 
modules, will the constant be replicated (defined) in the object files of all 
those modules? That would seem like a waste of space... Especially if the 
constant would be a large array.

I'm in the "new year cleanup" mood and I thought I could do a couple of 
trivial things just for fun :)

Cheers, Kuba Ober



Re: const cleanup... where do consts in namespaces go

2004-01-02 Thread Lars Gullik Bjønnes
Kuba Ober <[EMAIL PROTECTED]> writes:

| Hi,
>
| I was thinking of doing some general const cleanup in the (probably very few) 
| places that may need it (if any at all). I'm thinking of it w/o looking at 
| the code yet (just downloaded from CVS) so please forgive if it doesn't 
| directly apply.
>
| What's the general karma of having something like
>
| const int blah = 123;
>
| in a header file, inside a namespace (or not)? As far as I take it,
| it's a 

Do we have those in header files?

that is not good.

and if we had them it should be

int const blah = 123;

and it would still be bad.
 
-- 
Lgb


Re: const cleanup... where do consts in namespaces go

2004-01-02 Thread Kuba Ober
> | What's the general karma of having something like
> |
> | const int blah = 123;
> |
> | in a header file, inside a namespace (or not)? As far as I take it,
> | it's a
>
> Do we have those in header files?
> that is not good.
> and if we had them it should be
> int const blah = 123;
> and it would still be bad.

Is there a practical difference between const int var and int const var ? 
Consider me dumb :(

So, if there are constants that need to be made accessible to users of say 
given class, what's the best way to expose them? If int const blah = 123 is 
not the way, then what would be the way?

I don't know whether LyX has those in header files yet, I'm just building a 
list of things to go over quickly.

Kuba



Re: const cleanup... where do consts in namespaces go

2004-01-02 Thread Lars Gullik Bjønnes
Kuba Ober <[EMAIL PROTECTED]> writes:

>> | What's the general karma of having something like
>> |
>> | const int blah = 123;
>> |
>> | in a header file, inside a namespace (or not)? As far as I take it,
>> | it's a
>>
>> Do we have those in header files?
>> that is not good.
>> and if we had them it should be
>> int const blah = 123;
>> and it would still be bad.
>
| Is there a practical difference between const int var and int const var ? 
| Consider me dumb :(

Yes :-) Consistency.

extern int const blah; // in the header file

int const blah = 123; // in the source file

-- 
Lgb



Re: const cleanup... where do consts in namespaces go

2004-01-02 Thread Kuba Ober
> | Is there a practical difference between const int var and int const var ?
> | Consider me dumb :(
>
> Yes :-) Consistency.
>
> extern int const blah; // in the header file
>
> int const blah = 123; // in the source file

OK, gotcha. Thanks.

Kuba