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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9c86eb13dd395066 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: CRC in Ada? Date: 1997/03/16 Message-ID: #1/1 X-Deja-AN: 226102558 References: <1997Mar2.220652@nova.wright.edu> <331bf6ce.2832564@news.logica.co.uk> <332B5EBD.3D9E@worldnet.att.net> <332C9185.61C1@worldnet.att.net> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-03-16T00:00:00+00:00 List-Id: Michael said <> OUCH! Sequential_IO is intended to be used for logical record I/O. I can see that one might be tempted to write non-portable code that (mis)used Sequential_IO in this manner in Ada 83 if you felt compelled to use the Ada 83 IO packages, instead of the more obvious choice of using C packages for a case like this (Ada 83 really lacked stream io, and in a case like this, which is obviously a case for stream io, the proper response in my view is to interface to C, rather than misuse the Ada packages). Why non-portable? Well there is absolutely *no* guarantee that this isntantiation will have anything to do with reading single bytes. It would be perfectly reasonable (indeed it is even somewhat encouraged by the RM) to prepend type information to each record so that type checking can be done on input. In Ada 95, if you want to use the Ada packages, you of course use Stream_IO, and not Sequential_IO for this purpose. It is absolutely no surprise that you get a huge difference between C and Ada if you code this way. Sequential_IO has no analog in C, it is at a much higher semantic level that the C routines. It is not at all surprising that you would see the peformance difference, and it says nothing about Ada-vs-C performance.