comp.lang.ada
 help / color / mirror / Atom feed
* Warning "others choice is redundant" on tagged object initialization
@ 2016-06-01 18:13 pascal.malaise
  2016-06-01 18:27 ` Jeffrey R. Carter
  0 siblings, 1 reply; 3+ messages in thread
From: pascal.malaise @ 2016-06-01 18:13 UTC (permalink / raw)


Gnat GPL 2016 is out... and raises a new warning for me.

Here is the code:
  type Timer_Id is new Smart_Timer_Mng.Handle with null record;
  No_Timer : constant Timer_Id
           := (Smart_Timer_Mng.Null_Handle with others => <>);

And the warning:
timers.ads:140:56: warning: others choice is redundant
timers.ads:140:56: warning: previous choices cover all components

I thought that this was the only way to initialize a sub-object "with null".
Am I missing something?

Thank you  

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

* Re: Warning "others choice is redundant" on tagged object initialization
  2016-06-01 18:13 Warning "others choice is redundant" on tagged object initialization pascal.malaise
@ 2016-06-01 18:27 ` Jeffrey R. Carter
  2016-06-02  5:14   ` pascal.malaise
  0 siblings, 1 reply; 3+ messages in thread
From: Jeffrey R. Carter @ 2016-06-01 18:27 UTC (permalink / raw)


On 06/01/2016 11:13 AM, pascal.malaise@gmail.com wrote:
> 
>   type Timer_Id is new Smart_Timer_Mng.Handle with null record;
>   No_Timer : constant Timer_Id
>            := (Smart_Timer_Mng.Null_Handle with others => <>);
> 
> timers.ads:140:56: warning: others choice is redundant
> timers.ads:140:56: warning: previous choices cover all components
> 
> I thought that this was the only way to initialize a sub-object "with null".
> Am I missing something?

ARM 4.3.2(9) says

"If all components of the value of the extension_aggregate are determined by the
ancestor_part, then the record_component_association_list is required to be
simply null record."

So perhaps you should replace "others => <>" with "null record".

-- 
Jeff Carter
"In the frozen land of Nador they were forced to
eat Robin's minstrels, and there was much rejoicing."
Monty Python & the Holy Grail
70


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

* Re: Warning "others choice is redundant" on tagged object initialization
  2016-06-01 18:27 ` Jeffrey R. Carter
@ 2016-06-02  5:14   ` pascal.malaise
  0 siblings, 0 replies; 3+ messages in thread
From: pascal.malaise @ 2016-06-02  5:14 UTC (permalink / raw)


Le mercredi 1 juin 2016 20:27:24 UTC+2, Jeffrey R. Carter a écrit :
> ARM 4.3.2(9) says
> 
> "If all components of the value of the extension_aggregate are determined by the
> ancestor_part, then the record_component_association_list is required to be
> simply null record."
> 
> So perhaps you should replace "others => <>" with "null record".

Indeed.
Thank you.


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

end of thread, other threads:[~2016-06-02  5:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-01 18:13 Warning "others choice is redundant" on tagged object initialization pascal.malaise
2016-06-01 18:27 ` Jeffrey R. Carter
2016-06-02  5:14   ` pascal.malaise

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