From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: How to make Ada popular. Get rid of ";" at end of statement.
Date: Fri, 26 Jul 2019 22:11:29 -0500
Date: 2019-07-26T22:11:29-05:00 [thread overview]
Message-ID: <qhgfd1$h24$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: lnh8785kge.fsf@kst-u.example.com
"Keith Thompson" <kst-u@mib.org> wrote in message
news:lnh8785kge.fsf@kst-u.example.com...
> Lucretia <laguest9000@googlemail.com> writes:
>> On Thursday, 25 July 2019 08:26:29 UTC+1, Maciej Sobczak wrote:
>>> > The one concrete reason I've ever heard for using C or C++ instead
>>> > of Modula-2 or Ada is that C/C++ allow you to perform pointer
>>> > arithmetic
>>>
>>> Really? I would never consider that reason myself.
>>
>> Me neither, but then you can do pointer arithmetic in Ada, you just
>> use normal numbers and convert to an address.
>
> I'm fairly sure there's no guarantee that the result of any such
> conversion (which would have to use Unchecked_Conversion or something
> equivalent, unless I've missed something) would be meaningful.
And there is in C?? ;-)
Package System.Storage_Elements includes operations for directly doing
address arithmetic - you would have to do the multiplies on values of
Storage_Offset (which is an integer type) and then add/subtract those from
values of System.Address.
One could use Address_to_Access_Conversions to turn an address into an
access value (which can then be dereferenced), as well as the reverse.
That's better than Unchecked_Conversion as any representation differences
can be handled properly, but admittedly there isn't much difference in the
safety of the result.
In any case, pointer arithmetic can be done in Ada more-or-less directly.
One wonders why it would be necessary (compiler optimizers can turn a lot of
loops on arrays into pointer arithmetic code anyway, so there's likely to be
little or no performance difference) - it sounds a lot like a combination of
premature optimization and a convinient (and wrong) excuse not to consider
Ada. (A lot of people out there are mainly looking for reasons not to use
Ada or Rust or whatever language so that they can use whatever they have
already decided on.)
Randy.
next prev parent reply other threads:[~2019-07-27 3:11 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 21:41 How to make Ada popular. Get rid of ";" at end of statement Nasser M. Abbasi
2019-07-19 22:09 ` Dmitry A. Kazakov
2019-07-20 6:47 ` J-P. Rosen
2019-07-20 8:42 ` Paul Rubin
2019-07-21 5:11 ` J-P. Rosen
2019-07-23 9:24 ` darek
2019-07-20 17:08 ` Stéphane Rivière
2019-07-20 13:46 ` Dennis Lee Bieber
2019-07-20 0:47 ` Matt Borchers
2019-07-20 13:54 ` Dennis Lee Bieber
2019-07-20 14:40 ` Stephen Davies
2019-07-20 15:45 ` Optikos
2019-07-20 17:24 ` joviangm
2019-07-20 19:10 ` Optikos
2019-07-20 19:17 ` AdaMagica
2019-07-20 22:25 ` Paul Rubin
2019-07-20 23:08 ` Optikos
2019-07-20 22:24 ` Paul Rubin
2019-07-20 21:14 ` Keith Thompson
2019-07-23 21:58 ` Ingo M.
2019-07-23 23:56 ` Paul Rubin
2019-07-24 14:06 ` John Perry
2019-07-24 14:51 ` Ingo M.
2019-07-24 15:29 ` Dmitry A. Kazakov
2019-07-25 10:58 ` Ingo M.
2019-07-25 12:16 ` Dmitry A. Kazakov
2019-07-26 10:54 ` antispam
2019-07-26 11:35 ` Niklas Holsti
2019-07-26 16:07 ` Simon Wright
2019-07-24 19:52 ` Ingo M.
2019-07-24 20:31 ` J-P. Rosen
2019-07-25 13:34 ` gautier_niouzes
2019-07-25 7:26 ` Maciej Sobczak
2019-07-25 10:47 ` Ingo M.
2019-07-25 16:18 ` John Perry
2019-07-25 18:31 ` Dennis Lee Bieber
2019-07-26 18:04 ` Shark8
2019-07-26 18:53 ` Niklas Holsti
2019-07-26 19:16 ` Niklas Holsti
2019-07-27 1:27 ` Lucretia
2019-07-27 1:34 ` Keith Thompson
2019-07-27 3:11 ` Randy Brukardt [this message]
2019-07-27 4:06 ` Keith Thompson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox