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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC 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 Path: g2news1.google.com!news1.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 14 Aug 2010 20:08:48 -0500 From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Ada Smileys in C++ lib Conversion Date: Sun, 15 Aug 2010 02:16:15 +0100 Reply-To: brian@shapes.demon.co.uk Message-ID: References: <1a9b39b0-73f6-497c-a8f4-abf8129886ac@t20g2000yqa.googlegroups.com> <9b88e5a4-c588-4997-ad5c-2efa216fe4f4@a4g2000prm.googlegroups.com> <95tc66hjv3stdk0nhdv9o46e5l2ecdog5j@4ax.com> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-xyaREcNjHEcACfHtjLXsPztSn9nMz8lf+F2ksSSaLzZqTwrJLyGbT9ThYrzg/nVjfa3WWkavFtk8V7X!DNoWAVgDTXhEbb+5awSgx/hMfn/R1TCer/i1HjoCPsuVX8Ba11myP4f6tOdBoQ3iyWkJ2H0xAIBt!elU= X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Xref: g2news1.google.com comp.lang.ada:13315 Date: 2010-08-15T02:16:15+01:00 List-Id: On Sat, 14 Aug 2010 13:34:54 -0700 (PDT), Maciej Sobczak wrote: >On 14 Sie, 12:57, Brian Drummond wrote: > >> I thought I was being really really smart years ago in C, when I decided to >> convert all those #defines to integer constants... >> >> const int MC_CTL_LOCAL_C �= 0x80; >> and so on. > >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! >> Of course I was declaring integer variables, who's storage class happens to be >> named "constant". >No, there is no such storage class. If these objects were globals >(which was most likely the case), then their storage class is static. OK you're right, it's a type qualifier not a storage class. >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. Nor does it mean that you can use the object just anywhere you'd expect to use a constant. >> 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. - Brian