James Giles wrote in message ... >Martin Dowie wrote: >> James Giles wrote: >... >>> In most Ada implementations, as for most other languages, all >>> the bit patterns in the representation of an INTEGER data type >>> are valid integer values. >> >> That's not entirely true, the standard states Integer must include the >> range �2**15+1 .. +2**15�1 - thus (usually) leaving -2**15 as a >> possible 'default uninitialized' value. > >Well I allowed for that possibility. I made no absolute >assertion. I said "most Ada implementations". In fact, >most language definitions *allow* implementations >to implement integers with a lot of flexibility. Most >actual implementations use all the bit patterns their >underlying hardware allows and *don't* use any of >them for NOI (Not An Integer). Exceptioins include WATFOR and WATFIV, PL/C. In BASIC, all variables have an initial value of zero. In IBM's PL/I [PC and mainframe] provision is made to detect uninitialized fixed-point decimal variables via hardware, and this has been the case of their mainframe PL/Is since 1965. The pre-decessor of WATFOR (IBM 704?) used hardware (parity bit set wrong) for uninitialized variables. > And, let's not forget >character data types (does your actual implementation >have a value that means NOC - Not A Character?). >What about booleans? Ada also has fixed point types, >enumerations, records, etc. Does your actual implementation >catch uses of undefined variables for all those? Indeed, >does it even use NANs from the floating point hardware to >detect uninitialized REALs? > >It's true: nearly all languages permit implementations >to internally represent data with additional memory >for the purpose of detecting and reporting uses of >undefined variables (and for other reasons - like the >value of a variable that was defined, but the expression >involved an unhandled exception). In formal semantics, >the idea is called a lifted domain. Applying it in software >is expensive at run-time. Not necessarily. It isn't in the case of Salford Fortran (now Silverfrost), nor in WATFOR and WATFIV, PL/C, and fixed-point decimal in IBM's PL/I compilers.