From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: why Ada type casting is different from other languages? newType(value) vs. (newType)value Date: Wed, 16 Jul 2014 00:47:48 +0200 Organization: A noiseless patient Spider Message-ID: References: <1cqb2iccfzox2$.f74qor2zqcub.dlg@40tude.net> <53c25e58$0$6665$9b4e6d93@newsspool3.arcor-online.net> Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 15 Jul 2014 22:47:41 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="9becc75767a8d02825b278758ac050d3"; logging-data="3158"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+y4Xpu2aFH4mPon/FoG0LVMLMbtMpEV9U=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: Cancel-Lock: sha1:Tq+sPjFXMDw2uv3k7v4BDailjiA= Xref: news.eternal-september.org comp.lang.ada:20958 Date: 2014-07-16T00:47:48+02:00 List-Id: On 15.07.14 21:14, Niklas Holsti wrote: > On 14-07-15 21:42 , G.B. wrote: > >> And later, is it really good or bad if it takes years or not >> to be competent enough to understand >> >> ptrdiff_t x = *(ptrdiff_t*)main; >> >> vs >> >> X : Integer_Address := To_Integer (Main'Address); >> >> if they are comparable? > > Aah... they are *not* "comparable", if by that you mean "equivalent". That formula was to serve as an escape route and... > Perhaps I misunderstood your point? ...you have proven my point, inasmuch as C's syntax (and other habits which could be ascribed to it) have made me confused, while Ada does not even require a type conversion. (I was copying from an earlier example, replacing "0xa100" with "main" of a different type.) OTOH, that's just this single programmer who, likely incompetently, messed up.