From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Subject: Re: Reduction expressions
Date: Tue, 20 Aug 2024 16:41:55 -0700 [thread overview]
Message-ID: <874j7edanw.fsf@nosuchdomain.example.com> (raw)
In-Reply-To: va38ve$3i3ne$11@dont-email.me
Lawrence D'Oliveiro <ldo@nz.invalid> writes:
[...]
> I thought the difference was obvious. “subtype” is the C equivalent of
> “typedef”, just giving a new name to an existing type. So
>
> subtype A is B;
>
> (where A and B are simple identifiers) is valid, whereas
>
> type A is B;
>
> is not: a “type” declaration always creates a new type: you have to write
> at least
>
> type A is new B;
>
> and now you have two types with different names that are structurally the
> same, but not compatible.
A subtype with no added constraint is similar to a C typedef, but given
subtype Digit is Integer range 0..9;
Digit is distinct from Integer (though they're both the same type).
C doesn't have anything directly corresponding to Ada subtypes.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
next prev parent reply other threads:[~2024-08-20 23:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 12:36 Reduction expressions Simon Wright
2024-08-20 3:59 ` Randy Brukardt
2024-08-20 21:23 ` Simon Wright
2024-08-20 23:30 ` Lawrence D'Oliveiro
2024-08-20 23:41 ` Keith Thompson [this message]
2024-08-21 1:37 ` Lawrence D'Oliveiro
2024-08-21 7:47 ` Simon Wright
2024-08-24 4:27 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox