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=-1.9 required=5.0 tests=BAYES_00,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,19c9b8adc049bc94,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit From: "quasar" Newsgroups: comp.lang.ada Subject: handling null pointers/records to functions Date: Sat, 21 Aug 2004 22:59:27 +1000 Organization: - X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 NNTP-Posting-Host: 220.244.246.241 X-Original-NNTP-Posting-Host: 220.244.246.241 Message-ID: <41274733@dnews.tpgi.com.au> X-Trace: dnews.tpgi.com.au!tpg.com.au 1093093171 220.244.246.241 (21 Aug 2004 22:59:31 +1000) Path: g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.freenet.de!solnet.ch!solnet.ch!nntp.gblx.net!nntp3.phx1!dnews.tpgi.com.au!tpg.com.au!not-for-mail Xref: g2news1.google.com comp.lang.ada:2909 Date: 2004-08-21T22:59:27+10:00 List-Id: 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