comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephen.Leake@gsfc.nasa.gov>
Subject: Re: static objects in ADA
Date: 1999/04/21
Date: 1999-04-21T00:00:00+00:00	[thread overview]
Message-ID: <ur9pdalus.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: YsRFDEAtZbH3EwNc@tioman.demon.co.uk

Mark Elson <mark@tioman.demon.co.uk> writes:

> Hi,
> 
> I'm a C++ programmer who is new to ADA. I've looked briefly in the Ref
> Manual and the FAQ but I can't find the answer to the following question
> 
> Is there an equivalent declaration (in ADA 95) to the static used in
> C++, i.e. so that objects are created at link time rather than at run
> time?

There is no keyword in Ada that means something similar to this
meaning of 'static' in C++, but you can easily declare objects that
are "created at link time rather than at run-time":

package body Stuff is

   State : State_Type;
   Count : Integer;

end Stuff;

Assuming State_Type is a plain record type (not derived from
Ada.Finalization.Controlled, not a task type, not a protected type),
these objects simply occupy data space; they have no run-time creation
code. Note that it is possible to do a similar thing in C++; in that
case, State_Type must be a plain struct with no constructor.

> 
> I am working on an embedded app which has a very short "boot-up" time
> requirement (10 to 20 ms). I am being told that using objects will
> greatly increase my app start time because of object creation overhead.
> Any comments appreciated.

In Ada, you have complete, direct control over all aspects of object
creation. The keyword 'new' must be used to dynamically create an
object (as it must be in C++). 

-- Stephe




  reply	other threads:[~1999-04-21  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-21  0:00 static objects in ADA Mark Elson
1999-04-21  0:00 ` Stephen Leake [this message]
1999-04-21  0:00 ` dennison
1999-04-21  0:00 ` Marin David Condic
1999-04-22  0:00 ` Samuel Mize
1999-04-25  0:00   ` Mark Elson
1999-04-25  0:00     ` Robert Dewar
1999-04-26  0:00     ` dennison
1999-04-26  0:00       ` Robert Dewar
1999-05-07  0:00     ` Mark Elson
1999-05-07  0:00       ` dennison
1999-04-25  0:00 ` Matthew Heaney
replies disabled

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