comp.lang.ada
 help / color / mirror / Atom feed
* "NULL" returned by a function
@ 2014-08-08 21:10 Victor Porton
  2014-08-08 21:19 ` Jeffrey Carter
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Victor Porton @ 2014-08-08 21:10 UTC (permalink / raw)


What if I want to make a function which returns either a value of type T or 
a value signifying "nothing" (like null pointer)?

To make things worse, T is a controlled type, so if we return just "access 
T" the finalization of the object of type T may be easily overlooked.

What is the best way to implement this? variant record? whatever?

Or maybe should I modify the type T to allow it contain "null" state? (In 
fact the particular T which I use can be easily modified to allow storing 
there null and checking whether it's state is null. But I think on the way 
not to be dependent on the ability to change the definition of T.)

-- 
Victor Porton - http://portonvictor.org

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

end of thread, other threads:[~2014-08-09 16:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-08 21:10 "NULL" returned by a function Victor Porton
2014-08-08 21:19 ` Jeffrey Carter
2014-08-08 22:04   ` Victor Porton
2014-08-08 22:50     ` Jeffrey Carter
2014-08-09 12:45   ` Victor Porton
2014-08-09 15:13     ` Jeffrey Carter
2014-08-08 21:25 ` Shark8
2014-08-09 16:15 ` Maciej Sobczak

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