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-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!postnews.google.com!m36g2000hse.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada Recursion with strings Date: Thu, 2 Oct 2008 23:54:23 -0700 (PDT) Organization: http://groups.google.com Message-ID: <6e76ea5c-8bca-4c22-b561-87d2039d8924@m36g2000hse.googlegroups.com> References: <2fJEk.367687$yE1.299201@attbi_s21> <758a1a91-7521-4ad3-9af0-a79d434ae60e@v28g2000hsv.googlegroups.com> NNTP-Posting-Host: 128.141.45.232 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1223016863 28690 127.0.0.1 (3 Oct 2008 06:54:23 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 3 Oct 2008 06:54:23 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: m36g2000hse.googlegroups.com; posting-host=128.141.45.232; 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.0.3) Gecko/2008092414 Firefox/3.0.3,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:2203 Date: 2008-10-02T23:54:23-07:00 List-Id: On 1 Pa=BC, 16:29, Adam Beneschan wrote: > > Bits_Per_Byte =A0 : constant :=3D 8; > > Values_Per_Byte : constant :=3D 2 ** Bits_Per_Byte; > > Yep, the advantage of that is that if the people who design the > Internet communication protocols suddenly decide that IP addresses are > going to use 9-bit bytes, all you have to do is change one constant, > rather than try to find all the 8's in your code and change them, > which is more error-prone. The people who design the Internet communication protocols will *never* decide that IP addresses are going to use 9-bit bytes, exactly because those tons of software that use 8's in the code. Note also that the majority of software cannot be recompiled because the source code is not available or just missing. I agree that constants should be named, but even most strict coding standards allow several literals to be unnamed and the smallest set is 0 and 1. I think that 2 and 8 are on the border of acceptance too. So: Buffer_Size :=3D Get_Buffer_Size_In_Bytes; Buffer_Bits :=3D Buffer_Size * 8; Is there any benefit from making the above more verbose with additional named constant? Or would it be confusing to anyone to see literal 8 (or some formula that is build around it) in representation clause? I don't think so. -- Maciej Sobczak * www.msobczak.com * www.inspirel.com Database Access Library for Ada: www.inspirel.com/soci-ada