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: 109fba,cd8ed9115942852f X-Google-NewGroupId: yes X-Google-Thread: 103376,b92b95c9b5585075 X-Google-NewGroupId: yes X-Google-Attributes: gid4f1905883f,gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feedme.ziplink.net!news.swapon.de!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.c++,comp.lang.ada Subject: Re: Why use C++? Date: Tue, 16 Aug 2011 21:13:18 +0200 Organization: cbb software GmbH Message-ID: <1qwybpbhjv11s.6orqbnwyy15z.dlg@40tude.net> References: <9ag33sFmuaU1@mid.individual.net> <1d8wyhvpcmpkd.ggiui9vebmtl.dlg@40tude.net> <150vz10ihvb5a.1lysmewa1muz4$.dlg@40tude.net> <1q4c610mmuxn7$.1k6s78wa0r8fj.dlg@40tude.net> <1vn800hbyx8k4$.1lsveclj56197$.dlg@40tude.net> <1gu6ni1yb54k3$.4nbvfqqndl8m$.dlg@40tude.net> <4e4a4534$0$7629$9b4e6d93@newsspool1.arcor-online.net> <17sfxzivd6ba0.1lpjrmelcfuoa$.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: zB+G1w3AIFUNmrmGN/yzqg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: g2news2.google.com comp.lang.c++:92839 comp.lang.ada:21627 Date: 2011-08-16T21:13:18+02:00 List-Id: On Tue, 16 Aug 2011 15:51:29 +0100, Bill Findlay wrote: > On 16/08/2011 11:58, in article 17sfxzivd6ba0.1lpjrmelcfuoa$.dlg@40tude.net, > "Dmitry A. Kazakov" wrote: > >> On Tue, 16 Aug 2011 12:23:48 +0200, Georg Bauhaus wrote: >> >>> Is changing only the representation of types, not the types, >>> necessarily premature optimization? >> >> The answer depends on the time the change is made. "Premature" in its >> original meaning (Knuth) means: during design, before functional >> requirements are met. > > There are important cases in which the representation of types is an > essential part of the functional requirement. I addressed this in my earlier post. > For example, writing a > bit-accurate emulator for an existing computer architecture; Actually not. You can represent an array of bits in any desired way. The order of bits and their actual layout in the memory (if observable), are unrelated: type Word is array (1..16) of Boolean; type Word is mod 2**16; type Word is range 0..2**16-1; type Word is new Wide_Character; You are free to choose any of them and yet remain "bit-accurate". Bit accuracy is defined by the implementation of Get_Bit, Get_Byte etc operations. > or processing data generated by a legacy non-Ada system. You need only one type for an octet or other atomic type used as the I/O unit. Note that this type is predefined by the I/O library, so normally there is no need not to define it. You cannot use anything more complex than that because there is no any guaranty on I/O semantics of composite type. > These cases are not the most common, but they are also not the ignorable > trivia you claim them to be. They are. The second case is communication to alien hardware/software protocols, it is my daily job. You don't need any representation clauses there. It is amazing how many people think otherwise. It seems that conflation of the encoding issues with type representations is very deep rooted. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de