comp.lang.ada
 help / color / mirror / Atom feed
From: NiGHTS <nights@unku.us>
Subject: How best to test for NULL in Ada?
Date: Thu, 2 Jul 2015 15:15:53 -0700 (PDT)
Date: 2015-07-02T15:15:53-07:00	[thread overview]
Message-ID: <764f86ed-3b89-4631-b3f3-4d2b1b8d3df0@googlegroups.com> (raw)

I have encountered several situations where I needed to test an access type for NULL or not. My instinct is to do something like this:

    if Some_Object /= null then ...

But many times I get this error:

    invalid operand type for operator "/="
    left operand has type "Some_Object_Type" defined at ...
    right operand has an access type

What is the correct way to test for NULL in Ada?


(If you want a specific example, I am trying to test if the Selected Path returned by Gtk.Tree_View.Get_Cursor in the GTK Library is valid or NULL. But situations like these occur many times in distinct situations so I'm not looking for a fix to this specific problem)


Thank you in advance for your help!

             reply	other threads:[~2015-07-02 22:15 UTC|newest]

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