From: "Dr. Michael Paus" <paus@ib-paus.com>
Subject: Re: Last stream problem: byte order
Date: Wed, 27 Mar 2002 19:12:58 +0100
Date: 2002-03-27T18:12:59+00:00 [thread overview]
Message-ID: <3CA20BAA.FD53C08A@ib-paus.com> (raw)
In-Reply-To: mailman.1017243242.6790.comp.lang.ada@ada.eu.org
Erik Sigra schrieb:
>
> tisdagen den 26 mars 2002 11.25 skrev du:
> > If you also check the byte order of your system at runtime (there is a
> > system constant in Ada which you can check) you can even achieve the effect
> > that all stream data is always written in network byte order independent of
> > the platform your program is running on.
>
> Why runtime check? Compile time check seems more reasonable to me. Or can the
> same compiled program really run on architectures with different endiannes?
It depends on how clever the compiler is. If the compiler optimizes the
static expression in the following if-statement away then it is indeed a
compile time check. Otherwise it is a run-time check.
if System.Default_Bit_Order = System.Low_Order_First then
... (swap the bytes)
else
... (don't swap the bytes)
end if;
But I don't think this makes a big difference in either case.
Michael
next prev parent reply other threads:[~2002-03-27 18:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-25 19:45 Last stream problem: byte order Erik Sigra
2002-03-25 22:28 ` Jeffrey Carter
2002-03-25 22:36 ` Stephen Leake
2002-03-26 4:32 ` Eric G. Miller
2002-03-26 10:25 ` Dr. Michael Paus
2002-03-26 17:53 ` Pascal Obry
2002-03-26 18:25 ` Dr. Michael Paus
2002-03-26 19:25 ` Pascal Obry
2002-03-27 15:37 ` Erik Sigra
2002-03-27 18:12 ` Dr. Michael Paus [this message]
2002-03-28 2:24 ` Eric G. Miller
2002-03-28 18:34 ` Stephen Leake
2002-03-28 18:38 ` Simon Wright
2002-03-29 2:08 ` Eric G. Miller
2002-03-29 6:52 ` Simon Wright
2002-03-29 7:06 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox