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: Graham Hughes Subject: Re: CRC in Ada? Date: 1997/03/11 Message-ID: <5g4k31$g54$1@A-abe.resnet.ucsb.edu>#1/1 X-Deja-AN: 224767279 Sender: graham@resnet.ucsb.edu References: <1997Mar2.220652@nova.wright.edu> <1997Mar5.131846.1@eisner> <5fmo1k$adm@mulga.cs.mu.OZ.AU> <1997Mar6.114441.1@eisner> <1997Mar7.090814.1@eisner> <33206340.2616@bix.com> <5g157e$pqf@ratatosk.uio.no> <5g1qtg$4ad$1@A-abe.resnet.ucsb.edu> Organization: UCSB Newsgroups: comp.lang.ada Date: 1997-03-11T00:00:00+00:00 List-Id: -----BEGIN PGP SIGNED MESSAGE----- dewar@merv.cs.nyu.edu (Robert Dewar) writes: >Sure you can read character by character, but you are paying a considerable >price, even in C, for doing so! Actually: virtually none. Now, any stdio library can do this any way it damn well pleases, but the *usual* way to implement the buffers is this: If you request a character to be read, it feeds you the next character in the buffer. If there isn't a next character in the buffer, it reads in BUFSIZ elements and tries again. If it can't read any elements in, then it returns EOF. This is simplified somewhat, as ungetc() has to work across buffers, and standard input is usually line buffered if it comes in from a tty (which is handled largely by reading in as much as possible, getting an EOF, and trying again later; see glibc). Now, since BUFSIZ is 1024 bytes on my computer, this is in fact quite efficient. The actual BUFSIZ varies from compiler to compiler and platform to platform, much as stdio itself does. I don't see why this is so hard to do in Ada. It's the most used library in C (even hello world programs call printf()). Oh, and as has been said earlier; with setvbuf, I can make the stream buffer any way I want. - -- Graham Hughes http://A-abe.resnet.ucsb.edu/~graham/ -- MIME & PGP mail OK. PGP Key fingerprint = E9 B7 5F A0 F8 88 9E 1E 7C 62 D9 88 E1 03 29 5B -----BEGIN PGP SIGNATURE----- Version: 2.6.3 Charset: noconv iQCVAwUBMyXTnCqNPSINiVE5AQEIHgP8C/daYdavY71nD4+/OiMVyhff2Cspbd0Q ip7yB+q7ATJEs9WyJU4id5oYxxDtEq3rD7pWQwkDYIuyIX22/cB4EgMkw40ubFFF NRClDGq8MhMsmm4q1KHBr0goR8t73wta/0H/zJw1VulRG+OqgfQ7zipL2/9r8jrY K+JV6wLBCQY= =PZp9 -----END PGP SIGNATURE-----