comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Debug code
Date: 1996/03/18
Date: 1996-03-18T00:00:00+00:00	[thread overview]
Message-ID: <DoGxo5.n2s@world.std.com> (raw)
In-Reply-To: dewar.827152644@schonberg

In article <dewar.827152644@schonberg>, Robert Dewar <dewar@cs.nyu.edu> wrote:
>... Actually thre are good reasons why
>this is not in the standard.

I disagree.

>... It is surprisingly quite difficult to define
>exactly from a semantic point of view (the issue is that if it really is
>equivalent to the if from a formal semantic point of view, then the
>compiler could draw conclusions from its existence and affect code 
>outside the Assert which you don't want.

I disagree.  I think this is exactly what you *do* want.  In this
regard, I see no difference between "pragma Assert(X <= 10);" and a
normal range check, as for "X: Integer range 1..100;".  IMHO, the pragma
should be *exactly* semantically equivalent to an if_statement.  (It's
not syntactically equivalent, because you can't put an if_statement in a
package spec.)  If you turn the pragma off, it should be *exactly*
semantically equivalent to a null_statement.

(I realize that Asserts can contain side effects, but that unfortunate
fact does not change my mind on this point.)

>you need a null statement:
>
>	else
>	   pragma Assert ( ...); null;
>        end if;

Yuck.  I regularly have to compile my code twice after inserting an
Assert, because of this Ada silliness.

>Incidentally the GNAT source is full of pragma Assert statements, which is
>why the current front end is very slow compared to what it will be in a
>future release.

Have you measured this?  Even if you're not ready to turn them off, it
would be interesting to try it just once, to see how much speed could be
gained by turning them off.

- Bob




  reply	other threads:[~1996-03-18  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1996Mar14.223326.13730@nosc.mil>
1996-03-15  0:00 ` Debug code David Weller
1996-03-18  0:00   ` Robert Dewar
1996-03-18  0:00     ` Robert A Duff [this message]
     [not found]       ` <dewar.827166947@schonberg>
1996-03-19  0:00         ` Norman H. Cohen
1996-03-15  0:00 ` Bob Kitzberger
1996-03-25  0:00 Debug Code Sundog Software
1996-03-25  0:00 ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1996-02-27  0:00 Jerry Blasdel
replies disabled

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