comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: How best to test for NULL in Ada?
Date: Fri, 3 Jul 2015 19:02:44 -0700 (PDT)
Date: 2015-07-03T19:02:44-07:00	[thread overview]
Message-ID: <c44ae7c4-7e7a-45f1-967d-0b526c3429cf@googlegroups.com> (raw)
In-Reply-To: <mn4k24$ndj$1@loke.gir.dk>

On Thursday, July 2, 2015 at 6:12:53 PM UTC-6, Randy Brukardt wrote:
>
> In Ada 2012 there is a hack available to avoid the use clause. (This comes 
> from Tucker Taft, who admitted to doing this during our recent ARG meeting 
> in Madrid. He got suitable groans for this usage...)
> 
>     if Some_Object not in null then
> 
> This membership uses the predefined equality for the type of Some_Object, 
> and it need not be visible. But this is a hack (it harms readability), and 
> it's dangerous if "=" has been redefined (as it always uses the predefined 
> "=", not the overridden one). Use at your own risk.

Hm I can see where, if you were writing your own "=" operator for Some_Object's type and it was (a) an access type, and (b) you needed to test for null that could be useful.


  reply	other threads:[~2015-07-04  2:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-02 22:15 How best to test for NULL in Ada? NiGHTS
2015-07-02 23:19 ` Jeffrey R. Carter
2015-07-03  0:12   ` Randy Brukardt
2015-07-04  2:02     ` Shark8 [this message]
2015-07-03  7:30   ` Dmitry A. Kazakov
2015-07-05 23:32 ` NiGHTS
replies disabled

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