comp.lang.ada
 help / color / mirror / Atom feed
* handling null pointers/records to functions
@ 2004-08-21 12:59 quasar
  2004-08-21 13:55 ` Jim Rogers
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: quasar @ 2004-08-21 12:59 UTC (permalink / 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 





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-08-22  4:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-21 12:59 handling null pointers/records to functions quasar
2004-08-21 13:55 ` Jim Rogers
2004-08-21 17:11   ` Georg Bauhaus
2004-08-21 19:54 ` Jeffrey Carter
2004-08-22  4:12 ` Steve

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