comp.lang.ada
 help / color / mirror / Atom feed
From: Al Christians <achrist@easystreet.com>
Subject: Re: Ada 95 LRM Error?
Date: 1999/01/27
Date: 1999-01-27T00:00:00+00:00	[thread overview]
Message-ID: <36AFC42A.57696F4D@easystreet.com> (raw)
In-Reply-To: 78oaj9$d9g@sjx-ixn5.ix.netcom.com

Richard D Riehle wrote about Interfaces.Cobol:
> 
>  As it is, the package is defined so it conforms to the conventions of
>  typical COBOL programming.
> 

But if I put non-numeric data into a Numeric, it will flunk the
Valid() test, right?

Since you speak of 'typical COBOL programming', can you enlighten me a 
little about why this interface looks the way it does?  

For example, the To_Binary(Num, Binary_Format)  function returns a
Byte_Array and not a Binary, and there is no corresponding
To_Long_Binary.  It looks like To_Binary decides what length of
Byte_Array to give back based on the digits of Num. I suppose that
the compiler can figure this all out at compile time, since digits
is static, but it seems a little odd that the size of a Byte_Array is
never really set anywhere in the visible code, but the subtype returned 
from To_Binary depends on Num's digits. It's also a little confusing
that there are 2 binary types, ie Binary and Long_Binary, but that in
GNAT, for example, the return values from To_Binary, come in four
different sizes (I think).

That the Binary_Format doesn't specify the field size also makes it a
little hard to be consistent with the Cobol code I know about, which
allows a compile time switch to indicate whether or not a number with
fewer than 3 digits uses one or two bytes. Here Interfaces.Cobol decides
that for me behind the scenes.

Thanks for your assistance, Richard.

Al




  reply	other threads:[~1999-01-27  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-27  0:00 Ada 95 LRM Error? Al Christians
1999-01-27  0:00 ` Martin C. Carlisle
1999-01-28  0:00   ` J. David Bryan
1999-01-28  0:00 ` robert_dewar
1999-01-28  0:00 ` Richard D Riehle
1999-01-27  0:00   ` Al Christians [this message]
1999-01-28  0:00     ` Richard D Riehle
1999-01-28  0:00       ` Interfaces.Cobol (Was LRM Error?) Al Christians
1999-01-29  0:00       ` Ada 95 LRM Error? robert_dewar
1999-01-31  0:00         ` Keith Thompson
1999-02-01  0:00           ` Types (was Ada 95 LRM Error?) Richard D Riehle
1999-02-02  0:00           ` Ada 95 LRM Error? robert_dewar
1999-01-28  0:00     ` robert_dewar
1999-01-28  0:00       ` Al Christians
replies disabled

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