Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework some wording around out and inout parameters #312

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions specs/language/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@

\p Parameters are either \textit{input parameters}, \textit{output parameters},
or \textit{input/output parameters} as denoted in the called function's
declaration (\ref{Decl.Function}).
declaration (\ref{Decl.Function}). For all types of parameters the argument
expressions are evaluated before the function call occurs.

\p \textit{Input parameters} are passed by-value into a function. If an argument
to an \textit{input parameter} is of constant-sized array type, the array is
Expand All @@ -204,9 +205,11 @@
undefined behavior to not explicitly initialize an \textit{output parameter}
before returning from the function in which it is defined. The cxvalue created
from an argument to an \textit{input/output parameter} is initialized through
copy-initialization from the lvalue argument expression. In both cases, the
cxvalue shall have the type of the parameter and the argument can be converted
to that type through implicit or explicit conversion.
copy-initialization from the lvalue argument expression. Overload resolution
shall occur on argument initialization as if the expression \texttt{T Param =
Arg} were evaluated. In both cases, the cxvalue shall have the type of the
parameter and the argument can be converted to that type through implicit or
explicit conversion.

\p If an argument to an \textit{output} or \textit{input/output parameter} is a
constant sized array, the array is copied to a temporary cxvalue following the
Expand All @@ -219,11 +222,14 @@
\texttt{T[N]}.

\p On expiration of the cxvalue, the value is assigned back to the argument
lvalue expression following an inverted conversion if applicable. The argument
expression must be of a type or able to convert to a type that has defined
copy-initialization to and from the parameter type. The lifetime of the cxvalue
begins at argument expression evaluation, and ends after the function returns. A
cxvalue argument is passed by-address to the caller.
lvalue expression using a resolved assignment expression as if the expression
\texttt{Arg = Param} were written\footnote{The argument expression is not
bfavela marked this conversation as resolved.
Show resolved Hide resolved
re-evaluated after the call, so any side effects of the call occur only before
the call.}. The argument expression must be of a type or able to convert to a
type that has defined copy-initialization to and assignment from the parameter
type. The lifetime of the cxvalue begins at argument expression evaluation, and
ends after the function returns. A cxvalue argument is passed by-address to the
caller.

\p If the lvalue passed to an \textit{output} or \textit{input/output parameter}
does not alias any other parameter passed to that function, an implementation
Expand Down
Loading