From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a6fe9ef21ba269dc X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!w30g2000yqw.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada Smileys in C++ lib Conversion Date: Sun, 15 Aug 2010 03:04:54 -0700 (PDT) Organization: http://groups.google.com Message-ID: <15cdcb9e-3747-48e3-9be0-8829dfbcc3c8@w30g2000yqw.googlegroups.com> References: <1a9b39b0-73f6-497c-a8f4-abf8129886ac@t20g2000yqa.googlegroups.com> <9b88e5a4-c588-4997-ad5c-2efa216fe4f4@a4g2000prm.googlegroups.com> <95tc66hjv3stdk0nhdv9o46e5l2ecdog5j@4ax.com> NNTP-Posting-Host: 81.63.86.77 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1281866694 15390 127.0.0.1 (15 Aug 2010 10:04:54 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 15 Aug 2010 10:04:54 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w30g2000yqw.googlegroups.com; posting-host=81.63.86.77; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:13328 Date: 2010-08-15T03:04:54-07:00 List-Id: On 15 Sie, 03:16, Brian Drummond 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