comp.lang.ada
 help / color / mirror / Atom feed
From: "quasar" <quasar@nospam.com>
Subject: handling null pointers/records to functions
Date: Sat, 21 Aug 2004 22:59:27 +1000
Date: 2004-08-21T22:59:27+10:00	[thread overview]
Message-ID: <41274733@dnews.tpgi.com.au> (raw)

Hi , I was wondering what is the best way to handle null records/pointers 
passed to functions with a return type that is generic?

for example in this snippet of code node_ptr_type is a record holding a 
single data value of type Data_Type

function Data_Part (Node_Ptr : Node_Ptr_Type ) return Data_Type is
begin
    if node_ptr /= null then
        return Node_Ptr.Data;
    else
        Put_Line("Node passed to FUNCTION DATA_PART is null");
        {(**)at this point i do not know what to do... do I terminate the 
program, do I return some form of null object}
    end if;
end Data_Part;

What is the most recommended way to handle this? Point (**) has got me 
stuck.

Thanks any help would be great
quasar 





             reply	other threads:[~2004-08-21 12:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-21 12:59 quasar [this message]
2004-08-21 13:55 ` handling null pointers/records to functions Jim Rogers
2004-08-21 17:11   ` Georg Bauhaus
2004-08-21 19:54 ` Jeffrey Carter
2004-08-22  4:12 ` Steve
replies disabled

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