comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Newbie: Task parametering
Date: Sun, 16 Oct 2005 21:37:28 -0500
Date: 2005-10-16T21:37:28-05:00	[thread overview]
Message-ID: <y_WdneMMKpr1k87eRVn-rQ@comcast.com> (raw)
In-Reply-To: 1129510387.675070.134750@g14g2000cwa.googlegroups.com

> type Task_Data is
>        record
>        Name : aliased String(1..8);
 and
>   type Data_Handle is access Task_Data; -- used to point to its data
Things of type Data_Handle point to heap-allocated objects (it says
"is access" not "is access all"), so you don't need any "aliased".

>     Data_For_Task := new Task_Data;
>     Data_For_Task.Name := "Task A  ";
>     Data_For_Task.Period := 0.5;
>     Data_For_Task.Repetitions := 5;
  Data_For_Task := new Task_Data("Task A  ", 0.5, 5);
or, more explicitly
  Data_For_Task := new Task_Data(
    (Name => "Task A  ", Period => 0.5, Repetitions => 5);
Besides being shorter, these have the advantage over multiple assignment
statements that the compiler will tell you if you left something out.



  reply	other threads:[~2005-10-17  2:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-17  0:23 Newbie: Task parametering Andrew Price
2005-10-17  0:53 ` jimmaureenrogers
2005-10-17  2:37   ` tmoran [this message]
2005-10-17  4:10     ` tmoran
2005-10-17  4:58   ` Andrew Price
2005-10-17 10:02     ` Jacob Sparre Andersen
2005-10-17 15:57   ` Poul-Erik Andreasen
2005-10-17 22:51   ` Stephen Leake
replies disabled

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