comp.lang.ada
 help / color / mirror / Atom feed
From: "DuckE" <nospam_steved94@home.com>
Subject: Re: Question on using protected objects
Date: Sat, 29 Sep 2001 15:09:20 GMT
Date: 2001-09-29T15:09:20+00:00	[thread overview]
Message-ID: <Ault7.53206$QK.35668390@news1.sttln1.wa.home.com> (raw)
In-Reply-To: GMkt7.44297$vq.9196633@typhoon.ne.mediaone.net

"Jeff Creem" <jeff@thecreems.com> wrote in message
news:GMkt7.44297$vq.9196633@typhoon.ne.mediaone.net...
>
> "DuckE" <nospam_steved94@home.com> wrote in message
> news:C9jt7.52545$QK.35535895@news1.sttln1.wa.home.com...
> > "Jeffrey Carter" <jrcarter@acm.org> wrote in message
> > news:3BB56747.D60CA49F@acm.org...
> > > What does your compiler say? (Hint: I suggest using GNAT with
the -gnaty
> > > option.)
> >
> > The compiler is perfectly happy with this.  It even "appears" to do
exactly
> > what I want.  If I were programming in C, that's as far as I would go
before
> > using this construct.  In Ada I try to avoid the "try it and see if it
> > works" mode of operation since it sometimes leads to unpredictable
> results.
>
>
> That is the strangest statement I ever heard. To summarize ... If you were
using
> a language where the compiler checks less at compile time and is less able
to
> tell you at run time about problems you are ?MORE? inclined to stop after
a clean
> compile and a run that appears to work?
>

My experience in C is that things are often not well defined.  When I try
something
in C, I don't expect that if it works in my test it will work the same for
different
compilers.  In Ada my expectations are higher.  In Ada I expect that if I
"play by
the rules" my source code will work across multiple compilers on multiple
targets.
  Just because some code is accepted by one compiler, it doesn't mean it
will be
accepted by all compilers.

In Ada (as well as in most other programming languages), if you give the
compiler
correct source code it will give you correct executables.  If you give the
compiler
bad source code the result is undefined.  In my experience Ada catches many
more
problems in source code at compile time than other languages, but in some
cases
you can still generate an executable from bad code.

For example bad source code might print a string that has not been
initialized.  The
results depend on many factors.

SteveD







  reply	other threads:[~2001-09-29 15:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-29  3:45 Question on using protected objects DuckE
2001-09-29  6:16 ` Jeffrey Carter
2001-09-29 12:30   ` DuckE
2001-09-29 14:20     ` Jeff Creem
2001-09-29 15:09       ` DuckE [this message]
2001-09-29 17:24     ` Ehud Lamm
2001-09-29 17:29 ` Tucker Taft
2001-09-29 19:01   ` DuckE
replies disabled

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