comp.lang.ada
 help / color / mirror / Atom feed
From: perez@oldcolo.com (Carlos Perez)
Subject: Re: Ada Portability... NOT!
Date: 21 Nov 1994 02:11:44 GMT
Date: 1994-11-21T02:11:44+00:00	[thread overview]
Message-ID: <3aovl0$79m@news-2.csn.net> (raw)
In-Reply-To: 3alalm$9di@gnat.cs.nyu.edu

Robert Dewar (dewar@cs.nyu.edu) wrote:
: A more portable approach in your particular case is to read the data into
: a byte stream (in Ada 9X, use a Storage_Array), and then use unchecked
: conversion to convert the data to usable floating-point form. 

: Isn't that interesting? The above advice says that you can make the code
: *more* portable by using unchecked_conversion. Often people have a knee-jerk
: reaction to avoid UC in portable code, but that's quite misinformed. Just as
: a careful C programmer will use (carefully chosen) cross-type casts to
: achieve portability, a careful Ada programmer can use (carefully chosen)
: unchecked conversions.

Count me in as one of those knee-jerk liberal Ada programmers ;-).  I guess
I've seen so many bad UC cases that its hard to imagine that it can be used
to create portable code.  For example, how do you "portably" take
care of the "endianess" of a machine that has plagued programmers since
the Dawn of Computing?  I certainly wouldn't write a generic byte-swapping
package unless I was force too.  And what about octal-hex converstions?
There may be a few old octal machines floating around (PDP's?) in 
garage sales somewhere (or in old military aircraft, I suppose).

: Actually in Ada 9X, this sort of problem is much better handled using
: streams in any case.

Cool... I'm new to 9X and will check this feature out.  Thanks for 
help!  I knew there was a reason I was a closet "team Ada" advocate!

-- Carlos




  reply	other threads:[~1994-11-21  2:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-11-18 21:04 Ada Portability... NOT! Capt. Britt Snodgrass
1994-11-19 16:55 ` Robert Dewar
1994-11-21  2:11   ` Carlos Perez [this message]
1994-11-21 13:17     ` Robert Dewar
1994-11-21 23:56   ` Keith Thompson
1994-11-22  3:53     ` Robert Dewar
1994-11-23 12:49     ` Michael J. Meier
1994-11-24 19:21       ` R_Tim_Coslet
1994-11-20  1:33 ` Carlos Perez
1994-11-21  5:06 ` Niklas Holsti
1994-11-21 16:19   ` Norman H. Cohen
1994-11-21 14:59 ` Mitch Gart
1994-11-21 15:40 ` Michael J. Meier
replies disabled

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