From: tmoran@acm.org
Subject: Re: Cross-platform issues
Date: Tue, 8 Dec 2009 00:33:04 +0000 (UTC)
Date: 2009-12-08T00:33:04+00:00 [thread overview]
Message-ID: <hfk6s0$vn7$1@aioe.org> (raw)
In-Reply-To: hfhf9l$2gh$1@news.albasani.net
> closely as possible to the one that inspired it. The original
> emits trace data with things like field length info in 4-byte
> integers, for example. I suppose that using a derived type to
> ensure that in my implementation those fields conform with the
> original is one way to do it, but is that accepted practice, or
> is there a more usual one?
Representation clauses and pragmas let you specify machine
characteristics, for instance that a particular field is 4 bytes long.
Types, and derived types, generally have to do with the logical nature of
the data
eg
type Field_Lengths is range 1 .. 64;
type Water_Temperatures is range 32 .. 212;
type Car_Mileages is range 0 .. 400_000;
etc
An item of any of those types would fit in a four byte field, even
though the first two types could fit in a single byte. In the absence
of a representation clause, the compiler is allowed to choose whatever
it likes. If you want something *represented* the same on two different
machines, or via two different compilers, use representation clauses.
next prev parent reply other threads:[~2009-12-08 0:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-05 21:23 Cross-platform issues Leslie
2009-12-06 17:13 ` John B. Matthews
2009-12-06 23:39 ` Leslie
2009-12-07 6:03 ` Per Sandberg
2009-12-07 21:05 ` sjw
2009-12-08 0:33 ` Randy Brukardt
2009-12-08 0:33 ` tmoran [this message]
2009-12-08 9:02 ` Martin
2009-12-08 19:46 ` Leslie
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox