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-7-bit Path: g2news1.google.com!news2.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: Mon, 16 Aug 2010 16:31:53 -0500 From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Ada Smileys in C++ lib Conversion Date: Mon, 16 Aug 2010 22:39:22 +0100 Reply-To: brian@shapes.demon.co.uk Message-ID: References: <9b88e5a4-c588-4997-ad5c-2efa216fe4f4@a4g2000prm.googlegroups.com> <95tc66hjv3stdk0nhdv9o46e5l2ecdog5j@4ax.com> <15cdcb9e-3747-48e3-9be0-8829dfbcc3c8@w30g2000yqw.googlegroups.com> <4915efdd-46ba-436b-b989-6067ce5a03bf@i31g2000yqm.googlegroups.com> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-QBoaHUKMi7aInopW2y6GaVOGXDfrgEKvlFzQ9YeUKkF40UaaC2UNroC0DtR5ucR+deBR0TEqm4Qc5y/!VPmY9tsblSDAVHE4JeI/gB680Yk4GedVUT/EcWWifNTTAf56X9aEx9wHHbGbCzq44PyydSC6iuk2!O6k= 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:13433 Date: 2010-08-16T22:39:22+01:00 List-Id: On Mon, 16 Aug 2010 05:39:34 -0700 (PDT), Maciej Sobczak wrote: >On 16 Sie, 14:30, Brian Drummond wrote: >> So a "const" is not constant, says the compiler. > >The above is guaranteed to work by the C++ standard (nerds see >5.19/1). And it does work in C++. (It was clear I was talking about C, yes?). >The problem will be when the initializer for "size" above will indeed >be a function call - this would not be a constant expression, even >though the object "size" is declared as const. >The reason is that constant expression should always evaluate to the >same value, whereas function calls are not required (and cannot be >verified) to do so. ... even though the function is only called once to initialise the const - and it is a "pure function" in Ada or VHDL terms - and all its arguments are consts (or even constants!). Does make me wonder what _can_ be verified in C++. >So, there is a difference between a "constant expression" (roughly >equivalent to Ada's "static expression") and a "const object". >Array bounds require constant expression. So we have - even in C++ - a const object that cannot be used where a constant expression is required. Interesting, Thanks. To get back almost on-topic, I am frequently amazed in Ada, after years of bruising by various {}-languages, how often I can program from the BNF, (i.e. "the BNF doesn't stop me doing this, but surely it can't be THAT simple..." and it just works. - Brian ... smiling