comp.lang.ada
 help / color / mirror / Atom feed
From: "Peter C. Chapin" <pchapin@sover.net>
Subject: Re: Advice on low level file handling.
Date: 05 Apr 2006 10:41:13 GMT
Date: 2006-04-05T10:41:13+00:00	[thread overview]
Message-ID: <Xns979C4420DD9D1pchapinsovernet@198.186.192.137> (raw)
In-Reply-To: R_adnVLVrp7jUazZRVn-rw@megapath.net

"Randy Brukardt" <randy@rrsoftware.com> wrote in
news:R_adnVLVrp7jUazZRVn-rw@megapath.net: 

> Why aren't you using Stream_IO for this? You don't need to declare
> your own types for this sort of I/O. Perhaps you thought that you
> could only use Stream_IO with the stream attributes? Actually, I think
> it is more useful to use by itself, especially in the sort of case you
> have here. Byte at a time I/O can be painfully slow; Stream_IO lets
> you input a batch of stuff and then process it.

I see. Thanks for the suggestion; I'll take a look at it.

> OTOH, if you *must* have an 8-bit byte, then I'd suggest declaring it
> yourself and using Sequential_IO as you did.

Well, the RFC is described in terms of 8-bit bytes so using anything 
else will result in an unclear correspondence between the code and the 
specification. At least, that would be my expectation.

On the other hand, it might make sense to define a suitable record type 
that has the necessary fields already specified in the right places and 
then just read a chunk of the file into such a record. However, part of 
the file needs to be uninterpreted data---it's not a file of records---
so this approach may not work out well either.

> Not really, but an Ada compiler will reject the program if it doesn't
> work. (As someone else pointed out, many Ada compilers don't support
> 64-bit numbers.) But it's probably portable enough for your purposes;
> there isn't much point in working around the lack of 64-bit math until
> you actually have to work on a compiler that doesn't support it.

I can see why the C99 standard added a 64 bit type to the standard. In 
today's world, objects larger than 2/4 GBytes are not unusual. It's 
awkward talking about such large sizes without a standard type to 
represent them. Does Ada 2005 have a built-in type that is 64 bits (or 
more)? 

Peter



  reply	other threads:[~2006-04-05 10:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-02  2:47 Advice on low level file handling Peter C. Chapin
2006-04-02 10:55 ` Georg Bauhaus
2006-04-04  1:31 ` Randy Brukardt
2006-04-05 10:41   ` Peter C. Chapin [this message]
2006-04-06  7:43     ` Michael Paus
2006-04-06 12:21       ` Peter C. Chapin
2006-04-06 12:46         ` Dmitry A. Kazakov
2006-04-06 14:13         ` Bob Spooner
2006-04-07 10:48         ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox