* Default values
@ 2016-12-25 9:23 Simon Wright
2016-12-25 11:53 ` Jeffrey R. Carter
2016-12-25 17:12 ` AdaMagica
0 siblings, 2 replies; 5+ messages in thread
From: Simon Wright @ 2016-12-25 9:23 UTC (permalink / raw)
Given
with Ada.Real_Time;
package Sbus.IMU is
subtype Radians_Per_Second is Float;
subtype Acceleration is Float;
subtype Milligauss is Float;
type Update (Magnetometer_Data_Present : Boolean := False) is record
Time_Valid : Ada.Real_Time.Time;
Gx, Gy, Gz : Radians_Per_Second;
Ax, Ay, Az : Acceleration;
case Magnetometer_Data_Present is
when True =>
Mx, My, Mz : Milligauss;
when False =>
null;
end case;
end record;
protected Updater is
procedure Put_New_Data (Data : Update);
entry Get_New_Data (Data : out Update);
procedure Get_Latest_Data (Data : out Update);
private
New_Data_Present : Boolean := False;
Latest_Data : Update := (others => <>);
end Updater;
end Sbus.IMU;
is the line
Latest_Data : Update := (others => <>);
legal? If so, what does it mean? (I've looked at the ARM for Record
Aggregates, 4.3.1, and Record Types. 3.8, and am no wiser).
I do realise that I need to put some default initializations in (or else
supply a proper initialization for Latest_Data!)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Default values
2016-12-25 9:23 Default values Simon Wright
@ 2016-12-25 11:53 ` Jeffrey R. Carter
2016-12-25 17:12 ` AdaMagica
1 sibling, 0 replies; 5+ messages in thread
From: Jeffrey R. Carter @ 2016-12-25 11:53 UTC (permalink / raw)
On 12/25/2016 10:23 AM, Simon Wright wrote:
>
> is the line
>
> Latest_Data : Update := (others => <>);
>
> legal? If so, what does it mean? (I've looked at the ARM for Record
> Aggregates, 4.3.1, and Record Types. 3.8, and am no wiser).
Yes, it's legal. It means the same thing as
Latest_Data : Update;
--
Jeff Carter
"Sheriff murdered, crops burned, stores looted,
people stampeded, and cattle raped."
Blazing Saddles
35
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Default values
2016-12-25 9:23 Default values Simon Wright
2016-12-25 11:53 ` Jeffrey R. Carter
@ 2016-12-25 17:12 ` AdaMagica
2016-12-25 20:20 ` Simon Wright
2016-12-27 23:32 ` Randy Brukardt
1 sibling, 2 replies; 5+ messages in thread
From: AdaMagica @ 2016-12-25 17:12 UTC (permalink / raw)
See RM 4.3.1. In your case,
Latest_Data: Update := (others => <>);
Latest_Data: Update;
mean the same.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-12-27 23:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-25 9:23 Default values Simon Wright
2016-12-25 11:53 ` Jeffrey R. Carter
2016-12-25 17:12 ` AdaMagica
2016-12-25 20:20 ` Simon Wright
2016-12-27 23:32 ` Randy Brukardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox