comp.lang.ada
 help / color / mirror / Atom feed
* Re: Use of constants on EFA
@ 1997-11-10  0:00 Tom Moran
  0 siblings, 0 replies; 11+ messages in thread
From: Tom Moran @ 1997-11-10  0:00 UTC (permalink / raw)



>5.4.2.1 Constants
>Objects shall be defined as being constant if their value is fixed
>throughout the execution of the software.
  "If (fixed) then (constant)" does not imply "If not(fixed) then
not(constant)" as any book on logic will tell any reader of that rule.
Perhaps some non-programmer doesn't know the difference between "if"
and "only if"?





^ permalink raw reply	[flat|nested] 11+ messages in thread
* Use of constants on EFA
@ 1997-11-05  0:00 Kevin Wilson
  1997-11-05  0:00 ` Robert Dewar
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Kevin Wilson @ 1997-11-05  0:00 UTC (permalink / raw)



For Eurofighter software we must conform to the following coding
standards :

EF Software Programmer's Manual PL-J-019-V-1101 Issue 4 April 1992
which contains a section saying :

5.4.2.1 Constants
Objects shall be defined as being constant if their value is fixed
throughout the execution of the software.

As would be expected we have taken this to mean that if a variable is fixed
within its scope (whatever this may be) then it should be a constant.

So for example

    declare
      Status : constant Status_Type := Get_Status ;
    begin
      if Status = Good
      then
        Do_This ;
      else
        Do_That ;
      end if ;
    end ;

would be OK.

However our customer (who must accept our code) states that constants
should only be declared at package level. They argue that in the
above example the constant will change its value if the code is executed
again, therefore is not fixed !

Apart from the question of good programming practice, we rely heavily
on declaring local constants to read unconstrained array structures
returned by functions and without this would require untidy interfaces
and I would imagine more memory.

Any comments on this would be appreciated or if there are any people
reading this who were involved in the writing of this document and can
clarify what was meant by this statement please let me know.

K.Wilson






^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~1997-11-17  0:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-10  0:00 Use of constants on EFA Tom Moran
  -- strict thread matches above, loose matches on Subject: below --
1997-11-05  0:00 Kevin Wilson
1997-11-05  0:00 ` Robert Dewar
1997-11-05  0:00 ` Robert Dewar
1997-11-06  0:00   ` Peter Hermann
1997-11-06  0:00 ` Matthew Heaney
     [not found] ` <01bceece$4a6a85e0$423c63c3@default>
1997-11-11  0:00   ` Michael F Brenner
1997-11-12  0:00   ` Karel Th�nissen
1997-11-12  0:00     ` Dale Stanbrough
1997-11-17  0:00       ` KevinWilson
     [not found]       ` <01bcefb3$a8ac9b80$a93163c3@default>
1997-11-17  0:00         ` Richard Toy

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