Alternatives to const.

mps@dent.uchicago.edu (Michael Spertus)
Thu, 24 Mar 1994 14:37:57 GMT

          From comp.compilers

Related articles
feature wanted: detect missing 'const' john_reiser@rainbow.mentorg.com (1994-03-16)
Re: feature wanted: detect missing 'const' bill@amber.csd.harris.com (1994-03-23)
Alternatives to const. mps@dent.uchicago.edu (1994-03-24)
Re: Alternatives to const. hbaker@netcom.com (1994-03-25)
Re: Alternatives to const. jan@neuroinformatik.ruhr-uni-bochum.de (1994-03-28)
| List of all articles for this month |
Newsgroups: comp.compilers
From: mps@dent.uchicago.edu (Michael Spertus)
Keywords: C++, design
Organization: Dept. of Mathematics
References: 94-03-064 94-03-116
Date: Thu, 24 Mar 1994 14:37:57 GMT



We are playing with the following. All parameters are declared in, out or
inout. They may be optionally be live and bare.


'in' means a copy of the caller's value is created for passing. This may
be optimized to a pointer but the user must see the callee's value as an
effective copy. This means you can pass anything that may be cast to the
callee's type.


'out' means a fresh copy of the value is created with default values. On
normal exit the parm is copied to the caller's side and any necessary
casts are done. On what we call failure or non local exit the out parm is
discarded. As with 'in' this may be optimized to a pointer where it is
transparent.


'inout' means the parm is initialized by in rules and returned to the
caller by out rules. Thus casts must exist in both directions between the
caller's variable and the callee's type.


'live' is an optional parm descriptor. This is implemented as pointer. The
callee sees the caller's value live, if the value changes independently
the callee sees it. Thus the callee's type must be a subtype of the
caller's type.


'bare' is an optional parm descriptor which may be applied to any
variable. It means the user of this variable sees the implementation as
well as the interface. The callee's parm must be of a type whose
implementation as well as interface subclasses the caller's variable. Thus
the function decides when it needs to see implementation. This minimizes
violation of encapsulation.


cef@geodesic.com
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.