From: Simon Wright <simon@pushface.org>
Subject: Default values
Date: Sun, 25 Dec 2016 09:23:14 +0000
Date: 2016-12-25T09:23:14+00:00 [thread overview]
Message-ID: <lyvau8z7jx.fsf@pushface.org> (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!)
next reply other threads:[~2016-12-25 9:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-25 9:23 Simon Wright [this message]
2016-12-25 11:53 ` Default values Jeffrey R. Carter
2016-12-25 17:12 ` AdaMagica
2016-12-25 20:20 ` Simon Wright
2016-12-27 23:32 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox