comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst-u@mib.org>
Subject: Re: How to make Ada popular. Get rid of ";" at end of statement.
Date: Fri, 26 Jul 2019 21:06:05 -0700
Date: 2019-07-26T21:06:05-07:00	[thread overview]
Message-ID: <lna7d05dg2.fsf@kst-u.example.com> (raw)
In-Reply-To: qhgfd1$h24$1@franka.jacob-sparre.dk

"Randy Brukardt" <randy@rrsoftware.com> writes:
> "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?? ;-)

No.  Did I imply that there is?

But C pointer arithmetic (without conversion to and from an integer
type) is well defined as long as you stay within a single (array)
object.  This isn't comp.lang.c, so I won't go into the details.

> 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.

So it does.  The standard doesn't seem to say much about
what operations are well defined beyond suggesting that they
"should reflect the target environment semantics as closely as
is reasonable".

(C *needs* to go into a lot more detail about pointer arithmetic
because so much of the language depends on it.)

[snip]

To be clear, I'm not making any arguments for or against C or Ada.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

      reply	other threads:[~2019-07-27  4:06 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
2019-07-27  4:06             ` Keith Thompson [this message]
replies disabled

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