comp.lang.ada
 help / color / mirror / Atom feed
* Sun Ada 3.0 / 2.1.1
@ 1999-05-17  0:00 Guy Calinsky
  1999-05-18  0:00 ` David C. Hoos, Sr.
  1999-05-22  0:00 ` Simon Wright
  0 siblings, 2 replies; 5+ messages in thread
From: Guy Calinsky @ 1999-05-17  0:00 UTC (permalink / raw)



I have a requirement to upgrade my project's compiler from Sun Ada 2.1.1
to Sun Ada 3.0.
Easy enough, except that my application makes several calls to C
functions, passing floating point numbers.
Whereas my application worked fine under 2.1.1, the floating point
numbers are not mapping correctly between 3.0 and C and I get junk for
results.  Does anybody know why this is?
Sun and Rational are being difficult.

Guy.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sun Ada 3.0 / 2.1.1
  1999-05-17  0:00 Sun Ada 3.0 / 2.1.1 Guy Calinsky
@ 1999-05-18  0:00 ` David C. Hoos, Sr.
  1999-05-24  0:00   ` fea
  1999-05-22  0:00 ` Simon Wright
  1 sibling, 1 reply; 5+ messages in thread
From: David C. Hoos, Sr. @ 1999-05-18  0:00 UTC (permalink / raw)



Guy Calinsky <calinsky@sll.northrop.com> wrote in message
news:37408CC0.5E601B20@sll.northrop.com...
>
> I have a requirement to upgrade my project's compiler from Sun Ada 2.1.1
> to Sun Ada 3.0.
> Easy enough, except that my application makes several calls to C
> functions, passing floating point numbers.
> Whereas my application worked fine under 2.1.1, the floating point
> numbers are not mapping correctly between 3.0 and C and I get junk for
> results.  Does anybody know why this is?
> Sun and Rational are being difficult.
>
My guess would be that your code has interfaces to C based on types from
the compiler's package Standard which have changed size.

For example, I remember that VADS on the SGI IRIX platform changed
their type Float from 32-bit to 64-bit, and the Oracle interface was
based on equating C float to VADS Float, and C double to VADS Long_Float.

You should have your own project-specific types of fixed size, to protect
yourself from compiler changes.

Of course Ada95 makes this much easier with the package Interface, and
its child Interfaces.C -- providing types which are specifically
equivalent to corresponding C types.







^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sun Ada 3.0 / 2.1.1
  1999-05-17  0:00 Sun Ada 3.0 / 2.1.1 Guy Calinsky
  1999-05-18  0:00 ` David C. Hoos, Sr.
@ 1999-05-22  0:00 ` Simon Wright
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Wright @ 1999-05-22  0:00 UTC (permalink / raw)


Guy Calinsky <calinsky@sll.northrop.com> writes:

> I have a requirement to upgrade my project's compiler from Sun Ada 2.1.1
> to Sun Ada 3.0.
> Easy enough, except that my application makes several calls to C
> functions, passing floating point numbers.
> Whereas my application worked fine under 2.1.1, the floating point
> numbers are not mapping correctly between 3.0 and C and I get junk for
> results.  Does anybody know why this is?
> Sun and Rational are being difficult.

I don't _know_ why, but could it be that the old Ada used double and
the new uses float? or vice versa? How have you declared the floating
point numbers in Ada? (sometimes the actual type used depends on your
declared range).

-- 
Simon Wright                        Work Email: simon.j.wright@gecm.com
Alenia Marconi Systems                         Voice: +44(0)1705-701778
Integrated Systems Division                      FAX: +44(0)1705-701800




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sun Ada 3.0 / 2.1.1
  1999-05-18  0:00 ` David C. Hoos, Sr.
@ 1999-05-24  0:00   ` fea
  1999-05-24  0:00     ` Robert Dewar
  0 siblings, 1 reply; 5+ messages in thread
From: fea @ 1999-05-24  0:00 UTC (permalink / raw)


David C. Hoos, Sr. wrote:
> 
> Guy Calinsky <calinsky@sll.northrop.com> wrote in message
> news:37408CC0.5E601B20@sll.northrop.com...
> >
> > I have a requirement to upgrade my project's compiler from Sun Ada 2.1.1
> > to Sun Ada 3.0.
> > Easy enough, except that my application makes several calls to C
> > functions, passing floating point numbers.
> > Whereas my application worked fine under 2.1.1, the floating point
> > numbers are not mapping correctly between 3.0 and C and I get junk for
> > results.  Does anybody know why this is?
> > Sun and Rational are being difficult.
> >
> My guess would be that your code has interfaces to C based on types from
> the compiler's package Standard which have changed size.
> 
> For example, I remember that VADS on the SGI IRIX platform changed
> their type Float from 32-bit to 64-bit, and the Oracle interface was
> based on equating C float to VADS Float, and C double to VADS Long_Float.
> 
> You should have your own project-specific types of fixed size, to protect
> yourself from compiler changes.
>

My project had the same requirement as you do and encountered
the same problem.  David's guess is 100% correct.  In Sun 2.1.1
"Float" is the same size as "Long_Float."  In Sun 3.0, its size
changed to that of "Short_Float."

While the correct solution is to isolate the dependency with a 
user defined type, our project didn't have time in the schedule
for that.  We found all the instances of "Float," changed them
to "Long_Float," and everything, including our C interface,
worked fine and made the delivery.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sun Ada 3.0 / 2.1.1
  1999-05-24  0:00   ` fea
@ 1999-05-24  0:00     ` Robert Dewar
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Dewar @ 1999-05-24  0:00 UTC (permalink / raw)


In article <3748CEEB.9815A4F5@gateway.net>,
  fea <fea@gateway.net> wrote:
> While the correct solution is to isolate the dependency with a
> user defined type

This is of course an Ada 83 style comment.

For Ada 95, there is no dependency in properly written code,
since you simply use the proper types from Interfaces.C to
match the float types in your C code, and you are guaranteed
portability, no matter what the definitions of the standard
types in the Ada compiler or the C compiler are.



--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1999-05-24  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-17  0:00 Sun Ada 3.0 / 2.1.1 Guy Calinsky
1999-05-18  0:00 ` David C. Hoos, Sr.
1999-05-24  0:00   ` fea
1999-05-24  0:00     ` Robert Dewar
1999-05-22  0:00 ` Simon Wright

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