From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Ada Smileys in C++ lib Conversion
Date: Sun, 15 Aug 2010 03:04:54 -0700 (PDT)
Date: 2010-08-15T03:04:54-07:00 [thread overview]
Message-ID: <15cdcb9e-3747-48e3-9be0-8829dfbcc3c8@w30g2000yqw.googlegroups.com> (raw)
In-Reply-To: a5fe665sg9vhdh80d5p8cqu6v3dlpfk5to@4ax.com
On 15 Sie, 03:16, Brian Drummond <brian_drumm...@btconnect.com> wrote:
> >Yes, this is a good practice. It is better to avoid using preprocessor
> >for anything other than so called include guards.
>
> Except when the result doesn't work!
If the result of *not* using preprocessor doesn't work, then with
preprocessor it would be even worse.
Can you give an example where using preprocessor works correctly,
whereas using typed constants does not?
> >Const means that the given name cannot be used to modify the referred
> >object and has nothing to do with the storage class (it might
> >influence the linkage, though).
>
> However, it does NOT mean the referred object cannot be modifed.
It cannot be modified via this name.
> Nor does it mean that you can use the object just anywhere you'd
> expect to use a constant.
Example, please. Example that shows that I cannot use const object
where constant is expected.
(Hint: there are some *very* obscure corner cases with templates, but
if you are there already, you are screwed anyway.)
> >> But it certainly puzzled me to be told that I couldn't use a "const" in a
> >> constant expression!
>
> >And what would that mean, anyway? How would you want to use it and
> >what would you like to achieve with it?
>
> In this instance I wanted to declare an array whose size was the constant
> expression in question.
const int size = 7;
int array[size];
Is this what you need? No problem with that.
--
Maciej Sobczak * http://www.inspirel.com
YAMI4 - Messaging Solution for Distributed Systems
http://www.inspirel.com/yami4
next prev parent reply other threads:[~2010-08-15 10:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-13 14:20 Ada Smileys in C++ lib Conversion Warren
2010-08-13 15:06 ` Yannick Duchêne (Hibou57)
2010-08-13 16:53 ` Anh Vo
2010-08-14 1:36 ` Warren
2010-08-14 9:52 ` Georg Bauhaus
2010-08-14 10:57 ` Brian Drummond
2010-08-14 20:34 ` Maciej Sobczak
2010-08-14 21:01 ` Dmitry A. Kazakov
2010-08-15 1:16 ` Brian Drummond
2010-08-15 10:04 ` Maciej Sobczak [this message]
2010-08-16 12:08 ` Brian Drummond
2010-08-16 12:13 ` Georg Bauhaus
2010-08-16 12:30 ` Brian Drummond
2010-08-16 12:39 ` Maciej Sobczak
2010-08-16 21:39 ` Brian Drummond
2010-08-16 22:53 ` Robert A Duff
2010-08-24 10:12 ` David Thompson
2010-08-30 9:51 ` Brian Drummond
2010-08-16 14:54 ` Warren
2010-08-16 20:27 ` Maciej Sobczak
2010-08-17 12:57 ` Warren
2010-08-17 13:37 ` Maciej Sobczak
2010-08-17 15:07 ` Georg Bauhaus
2010-08-18 17:31 ` Warren
2010-08-24 10:12 ` David Thompson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox