comp.lang.ada
 help / color / mirror / Atom feed
From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!wupost!waikato.ac.nz!pdenize
Subject: Vax Ada - Runtime Crashes
Date: 2 Sep 91 23:48:52 GMT	[thread overview]
Message-ID: <1991Sep3.114852.4814@waikato.ac.nz> (raw)

with Standard_Disclaimer;

My name is Paul Denize, until last year I was an Ada Programmer for the
Royal New Zealand Navy.  Since then I have been appointed a lecturer in
computer science at the University of Waikato.

I have upon arrival picked up on Vax Ada version 1.5 and discovered that 
the language behaves slightly differently to what I have been used to.

In the Navy I was using ALSYS Ada and unless I found a comiler flaw which the
company generally acknowledged then fixed your program NEVER crashed without 
generating an Ada Exception.  I had got quite used to this methodology.

However I toyed with Vax Ada and managed a number of crashes within an hour
which I would have expected a CONSTRAINT_ERROR for.

I defined an enumerated type say

    traffic_light_colour = (Red, Amber, Green);

Then I produced a generic bit operator called NOT and negated a variable of typ
e
traffic_light_colour.  Now Not Amber = Green, and Not Green = Amber, but 
Not Red resulted in a runtime death with no Ada Exception.


Should I have expected this ?

If I use unsafe methods to assign values how can I later check that the value
is within the bounds without causing a runtime failure.  It seems the compiler
generates assumptions about the bounds of a variable that under some instances
may not be true.  I have no problem with this I was the idiot that created the
unsafe conversion/assignment I should ensure the value(s) are safe.  HOW ?
Even more to the point what if its a record, Do I have to check every field ?

PEEEEUUUUUKKKKKEEEE !

Paul Denize.

-------------------------------------------------------------------------------
- Everyone agrees that the Modula-2 language has one ommision, no-one agrees  -
- what the ommission is.                                                      -
-------------------------------------------------------------------------------

                 reply	other threads:[~1991-09-02 23:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

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