comp.lang.ada
 help / color / mirror / Atom feed
* 64 bit integers
@ 2002-05-29 15:27 David Rasmussen
  2002-05-29 16:35 ` Marin David Condic
  2002-05-29 18:07 ` Jeffrey Carter
  0 siblings, 2 replies; 4+ messages in thread
From: David Rasmussen @ 2002-05-29 15:27 UTC (permalink / raw)


Can I be reasonably sure that if I use some sort of 64-bit integer in 
Ada, that it will be represented by native 64-bit registers on a 64-bit 
machine, and perhaps even more important, that it will be represented by 
some very effecient double 32-bit registers scheme on a 32-bit processor?

For instance, with GNAT, will it be as fast to use Ada for this kind of 
thing as it will be to use long long with GNU's C or C++ compiler?

/David




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

* Re: 64 bit integers
  2002-05-29 15:27 64 bit integers David Rasmussen
@ 2002-05-29 16:35 ` Marin David Condic
  2002-05-31  8:11   ` Antonio Duran
  2002-05-29 18:07 ` Jeffrey Carter
  1 sibling, 1 reply; 4+ messages in thread
From: Marin David Condic @ 2002-05-29 16:35 UTC (permalink / raw)


The only way to be sure is to conduct tests and/or check documentation
and/or call your vendor. Ada will let you express representation, so you
should feel confident that you're actually going to get 64 bits, etc. (or an
error message if the compiler can't support it.) But what you're going to
get for instructions & registers is not certain. One would hope that a
reasonable implementation for a machine that supported 64 bit numbers would
give you what you expect. It would be surprisingly inefficient for a mature,
reputable compiler to do something else, but at the end of the day you don't
get any guarantees from the language. Early, inefficient implementations of
Ada83 often generated subroutine calls to synthesize lots of math operations
because it was the simplest way to guarantee they satisfied the language
rules. Hopefully, things are better these days with your compiler. :-) Try
coding up an example and get the compiler to spit out assembly code & see
what you get.

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com


"David Rasmussen" <pinkfloydhomer@yahoo.com> wrote in message
news:3CF4F374.5010306@yahoo.com...
> Can I be reasonably sure that if I use some sort of 64-bit integer in
> Ada, that it will be represented by native 64-bit registers on a 64-bit
> machine, and perhaps even more important, that it will be represented by
> some very effecient double 32-bit registers scheme on a 32-bit processor?
>
> For instance, with GNAT, will it be as fast to use Ada for this kind of
> thing as it will be to use long long with GNU's C or C++ compiler?
>
> /David
>





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

* Re: 64 bit integers
  2002-05-29 15:27 64 bit integers David Rasmussen
  2002-05-29 16:35 ` Marin David Condic
@ 2002-05-29 18:07 ` Jeffrey Carter
  1 sibling, 0 replies; 4+ messages in thread
From: Jeffrey Carter @ 2002-05-29 18:07 UTC (permalink / raw)


David Rasmussen wrote:
> 
> Can I be reasonably sure that if I use some sort of 64-bit integer in
> Ada, that it will be represented by native 64-bit registers on a 64-bit
> machine, and perhaps even more important, that it will be represented by
> some very effecient double 32-bit registers scheme on a 32-bit processor?

Yes, you can be reasonably sure. If you need to be completely sure, then
you need to evaluate the object code output by candidate compilers.

> 
> For instance, with GNAT, will it be as fast to use Ada for this kind of
> thing as it will be to use long long with GNU's C or C++ compiler?

This depends a lot on what you want to do and what you mean by "be as
fast". It will probably be faster to get to a correct program in Ada
than in C/++, for example.

If you're talking about the speed of the generated code for dealing with
integers, it still depends. If you want overflow checking, for example,
the Ada code will probably be faster than the C/++ code, since in C/++
you will have to manually include overflow checks, and they will always
be executed. In Ada, the compiler automatically includes the checks, and
can optimize them away when they are unnecessary.

-- 
Jeff Carter
"You couldn't catch clap in a brothel, silly English K...niggets."
Monty Python & the Holy Grail



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

* Re: 64 bit integers
  2002-05-29 16:35 ` Marin David Condic
@ 2002-05-31  8:11   ` Antonio Duran
  0 siblings, 0 replies; 4+ messages in thread
From: Antonio Duran @ 2002-05-31  8:11 UTC (permalink / raw)


"Marin David Condic" <dont.bother.mcondic.auntie.spam@[acm.org> wrote in message news:<ad301f$h5p$1@nh.pace.co.uk>...
> The only way to be sure is to conduct tests and/or check documentation
> and/or call your vendor. Ada will let you express representation, so you
> should feel confident that you're actually going to get 64 bits, etc. (or an
> error message if the compiler can't support it.) But what you're going to
> get for instructions & registers is not certain. One would hope that a
> reasonable implementation for a machine that supported 64 bit numbers would
> give you what you expect. It would be surprisingly inefficient for a mature,
> reputable compiler to do something else, but at the end of the day you don't
> get any guarantees from the language. Early, inefficient implementations of
> Ada83 often generated subroutine calls to synthesize lots of math operations
> because it was the simplest way to guarantee they satisfied the language
> rules. Hopefully, things are better these days with your compiler. :-) Try
> coding up an example and get the compiler to spit out assembly code & see
> what you get.
> 
> MDC
> --
> Marin David Condic
> Senior Software Engineer
> Pace Micro Technology Americas    www.pacemicro.com
> Enabling the digital revolution
> e-Mail:    marin.condic@pacemicro.com
> 
> 
> "David Rasmussen" <pinkfloydhomer@yahoo.com> wrote in message
> news:3CF4F374.5010306@yahoo.com...
> > Can I be reasonably sure that if I use some sort of 64-bit integer in
> > Ada, that it will be represented by native 64-bit registers on a 64-bit
> > machine, and perhaps even more important, that it will be represented by
> > some very effecient double 32-bit registers scheme on a 32-bit processor?
> >
> > For instance, with GNAT, will it be as fast to use Ada for this kind of
> > thing as it will be to use long long with GNU's C or C++ compiler?
> >
> > /David
> >

What you can expect is that the Ada implementation will choose a
representation that fit the needs for 64 bit integers. If there is a
definite representation or performance requirement you should evaluate
different Ada compiler vendors and products and choose the one that
fits your specific needs.

On the other hand you could be reasonably sure that you can develop
your software (I mean code, test, and debug) using one compiler and,
when you find other that meets your requirements, port easily the code
to that implementation. That is undoubtly a huge advantage over a lot
of nasty #ifdef directives.
 
  Antonio Duran



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

end of thread, other threads:[~2002-05-31  8:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-29 15:27 64 bit integers David Rasmussen
2002-05-29 16:35 ` Marin David Condic
2002-05-31  8:11   ` Antonio Duran
2002-05-29 18:07 ` Jeffrey Carter

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