comp.lang.ada
 help / color / mirror / Atom feed
From: Kilgallen@SpamCop.net (Larry Kilgallen)
Subject: Re: newbie inquiry
Date: 12 Jun 2002 12:05:01 -0600
Date: 2002-06-12T12:05:01-06:00	[thread overview]
Message-ID: <MiwxDmau$0Yj@eisner.encompasserve.org> (raw)
In-Reply-To: ae7rpt$kfi$1@bunyip.cc.uq.edu.au

In article <ae7rpt$kfi$1@bunyip.cc.uq.edu.au>, "Steven Shaw" <steve.shaw@uq.net.au> writes:

> I read somewhere that Ada doesn't have GC. I think I heard that gnat
> supports gc. How does this work out for you? Does this mean you have to use
> free() when using the standard library?

The Ada language definition is susceptible to a garbage-collecting
implementation, but typical implementations (including GNAT) do not
provide it.  The general answer as to "why not?" seems to be that
there is not much demand for garbage collection from Ada customers.
An earlier (from my observation point on the Internet) pointed to
Controlled Types, a more efficient mechanism to perform some (but not
all) of the work done by garbage collection.  But some situations in
Ada are quite different from in other languages.  Let us say you are
going to call a function What_Size to determine how big you need to
allocate a temporary array.  In Ada that could be:

	My_Size := What_Size;
	declare			-- scope of My_Array
		My_Array : FirnBlatt_Array ( 1 .. My_Size);
	begin			-- scope of My_Array
		null;	-- here we would make use of My_Array
	end;			-- scope of My_Array

That is it.  When one gets to "end;" the runtime-sized My_Array is gone,
with no need to explicitly call a deallocation function.

> Would Ada be as good a choice as C for writing an OS? a dbms?

Yes, because Ada has the option of automatically providing lots
of runtime checks on the sanity of your data.  If you think those
are slowing your program down, it is possible to suppress some or
all of those checks in the final production program, yielding the
equivalent of the unchecking C program.  But so long as Ada can
still find errors in your test runs with those checks, Ada is able
to contribute something to your project -- letting you know early
on what is wrong with your program rather than simply failing with
an illegal memory reference that is difficult to analyze.

> The Ada spec is very big. Is it all implemented in gnats? Are there features
> in the spec that could/should be avoided?

One reason the Ada specification is so big is that is fully specifies
the behavior in many areas that might have been omitted in specification
of an earlier language.

GNAT implements the whole thing.

You should avoid any features you don't really need in your program.
I have been using Ada for 14 years, and I do not think I have ever
used a floating point number.  It took a while before I started using
the "exit when" feature.  For a long time I did not use tasking.  That
is not because tasking is bad, but because it was not needed for the
programs I had to write.



  parent reply	other threads:[~2002-06-12 18:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-12 16:09 newbie inquiry Steven Shaw
2002-06-12 16:26 ` Jean-Marc Bourguet
2002-06-12 18:09   ` Pascal Obry
2002-06-12 19:50     ` Ed Falis
2002-06-14  7:27     ` Jean-Marc Bourguet
2002-06-12 18:04 ` Stephen Leake
2002-06-12 21:22   ` Mark Johnson
2002-06-12 18:05 ` Larry Kilgallen [this message]
2002-06-12 20:14 ` Jeffrey Carter
2002-06-13 15:35   ` Ted Dennison
2002-06-13 20:12     ` Freddy
2002-06-14  2:49       ` Ted Dennison
2002-06-15 21:38         ` Robert A Duff
2002-06-16 22:16           ` Ted Dennison
2002-06-13 15:19 ` Ted Dennison
2002-06-13 23:26   ` Caffeine Junky
2002-06-14  2:55     ` Ted Dennison
2002-06-14  3:29       ` Darren New
2002-06-14 18:56         ` Ted Dennison
2002-06-14 19:05           ` Darren New
replies disabled

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