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,5ae752c88e0dde5e X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!news4.google.com!feeder.news-service.com!newsfeed.straub-nv.de!news.musoftware.de!wum.musoftware.de!news.weisnix.org!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Using representation clauses in networking software Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <8739ugqfeb.fsf@mid.deneb.enyo.de> <43fkp7an4c5m$.3db3n6adym42.dlg@40tude.net> <8739ugkka6.fsf@mid.deneb.enyo.de> <1pjh30gv98n9t$.lycfvhr1l9rz$.dlg@40tude.net> <87tymvhoy5.fsf@mid.deneb.enyo.de> <1x3jdyxqnl1e7.xlqx0giurt0x.dlg@40tude.net> Date: Sun, 15 Aug 2010 19:58:11 +0200 Message-ID: <1uzfyshtk9wpq.1ft0ehpgbw60k.dlg@40tude.net> NNTP-Posting-Date: 15 Aug 2010 19:58:08 CEST NNTP-Posting-Host: 54ad58cb.newsspool3.arcor-online.net X-Trace: DXC=<0Qhg2kmkR1i6K;>iZ]763McF=Q^Z^V384Fo<]lROoR18kF1@A\TYiM3;[6LHn;2LCV>[9=MJYA On Sun, 15 Aug 2010 18:40:15 +0200, Yannick Duch�ne (Hibou57) wrote: > Le Sun, 15 Aug 2010 18:10:08 +0200, Dmitry A. Kazakov > a �crit: >>> Would it make sense to deprecate them? >> >> Maybe, especially because they do not allow writing portable programs >> anyway. > How do you handle this then ? Dynamically: Value := Unsigned_16 (Buffer (Index)) * 256 + Unsigned_16 (Buffer (Index + 1)); Index := Index + 2; ... exception when Constraint_Error => Raise_Exception (Protocol_Error'Identity, "Malformed telegram at ... BTW, an ability to handle protocol errors is another good argument against representation clauses. > How would interface API as an example ? > Formated memory blocks ? It is usually layered, at least: raw I/O, telegrams, application layer. In reality it can be more, because modern time protocols themselves are layered. Many of them are dynamic. You just cannot statically describe all queries and responses. You ask the device capacities, build query lists, configure events, start measures, stop measures. It is far too complex for representation clauses. > Can you give an example case where this shows to be contradictory with > portability ? When using representation clauses? In order to use them you have two parameters in the equation: the internal endianness and external endianness. How can it be statically independent on the former (=portable)? Well, with conditional expressions of Ada 201X, maybe, it could be possible to describe. But I don't want to be one to maintain that mess. I'd better stick to good old means. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de