comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.plus-bug.tsoh@maps.futureapps.de>
Subject: Re: if Restrict_Func /= null confusion
Date: Sun, 30 Mar 2008 23:44:18 +0200
Date: 2008-03-30T23:44:18+02:00	[thread overview]
Message-ID: <1206913458.22025.4.camel@K72> (raw)
In-Reply-To: <95f36a62-b94c-4211-896a-300fa98932b7@x41g2000hsb.googlegroups.com> <95f36a62-b94c-4211-896a-300fa98932b7@x41g2000hsb.googlegroups.com>


On Sun, 2008-03-30 at 13:58 -0700, ma740988@gmail.com wrote:

> -- used to restrict a variable within a range
> -- for example: -PI to +PI
> type Restrict_Function is access function (X: Real4) return Real4;
> 
> type Filt_Data is
>   record
>      Restrict_Func   : Restrict_Function ;
> 
>   end record ;
> 
> 
>    --  within a procedure we have
>   Fdata             : Filt_Data;
>   Restrict_Func : Restrict_Function := FData.Restrict_Func ;
> 
>   if  Restrict_Func /= null then
>    -- stuff
>   endif
> 
> At issue:  I'm not following the conditional logic 'if (Restrict_Func /
> = null)'.  Not understanding the impetus behind the check for null.

The type Restrict_Function includes the null value.
The FData.Restrict_Func record component gets the default
initial value for access values. It is therefore null.
So Filt_Data.Restrict_Func is actually null.






      parent reply	other threads:[~2008-03-30 21:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-30 20:58 if Restrict_Func /= null confusion ma740988
2008-03-30 21:34 ` jimmaureenrogers
2008-03-30 21:36 ` Ludovic Brenta
2008-03-30 21:37 ` Robert A Duff
2008-03-30 21:44 ` Georg Bauhaus [this message]
replies disabled

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