From: Anh Vo <anhvofrcaus@gmail.com>
Subject: Re: Here is why C and C++ are bad...
Date: Sat, 26 Dec 2015 11:21:45 -0800 (PST)
Date: 2015-12-26T11:21:45-08:00 [thread overview]
Message-ID: <cd805655-859c-419b-ad42-3101ae8a6d2a@googlegroups.com> (raw)
In-Reply-To: <28691853-48fd-4d68-b28b-3ecbaf7a1bc0@googlegroups.com>
On Saturday, December 26, 2015 at 4:47:23 AM UTC-8, Serge Robyns wrote:
> On Friday, 25 December 2015 22:54:10 UTC+1, Ramine wrote:
>
> with Ada.Text_IO; use Ada.Text_IO;
>
> procedure test is
> u : Natural := 1234;
> i : Integer := -1233;
> result1 : Natural;
>
> begin
> result1 := u + i;
> Put_Line ("result: " & Natural'Image (result1));
> end test;
and your point is? This compiles since Natural is a subtype of Integer. Otherwise, it will be rejected by the compiler if u : New_Natural := 1234; where type New_Natural is new Integer range 0 .. Integer'Last; Thus, this example did not demonstrate the mixing of two separate types.
next parent reply other threads:[~2015-12-26 19:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <n5kdp5$cji$5@dont-email.me>
[not found] ` <28691853-48fd-4d68-b28b-3ecbaf7a1bc0@googlegroups.com>
2015-12-26 19:21 ` Anh Vo [this message]
2015-12-27 11:25 ` Here is why C and C++ are bad Serge Robyns
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox