Skip to content

[stmt.ranged] Do not use \grammarterm for begin-expr and end-expr. #1558

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

Merged
merged 1 commit into from
Mar 19, 2017
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
12 changes: 6 additions & 6 deletions source/statements.tex
Original file line number Diff line number Diff line change
Expand Up @@ -659,24 +659,24 @@
exposition only; and

\item
\textit{begin-expr} and \textit{end-expr} are determined as follows:
\placeholder{begin-expr} and \placeholder{end-expr} are determined as follows:

\begin{itemize}
\item if the \grammarterm{for-range-initializer} is an expression of
array type \tcode{R}, \textit{begin-expr} and \textit{end-expr} are
array type \tcode{R}, \placeholder{begin-expr} and \placeholder{end-expr} are
\tcode{__range} and \tcode{__range + __bound}, respectively, where \tcode{__bound} is
the array bound. If \tcode{R} is an array of unknown size or an array of
the array bound. If \tcode{R} is an array of unknown bound or an array of
incomplete type, the program is ill-formed;

\item if the \grammarterm{for-range-initializer} is an expression of
class type \tcode{C}, the \grammarterm{unqualified-id}{s}
\tcode{begin} and \tcode{end} are looked up in the scope of \tcode{C}
as if by class member access lookup~(\ref{basic.lookup.classref}), and if either
(or both) finds at least one declaration, \grammarterm{begin-expr} and
\grammarterm{end-expr} are \tcode{__range.begin()} and \tcode{__range.end()},
(or both) finds at least one declaration, \placeholder{begin-expr} and
\placeholder{end-expr} are \tcode{__range.begin()} and \tcode{__range.end()},
respectively;

\item otherwise, \textit{begin-expr} and \textit{end-expr} are \tcode{begin(__range)}
\item otherwise, \placeholder{begin-expr} and \placeholder{end-expr} are \tcode{begin(__range)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jensmaurer: This is fine, but when do we use literal __ and when do we use \xname?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, I don't quite understand the question. What's \xname?

And yes, I'm not totally happy with __range instead of introducing some readable variable and saying its name is unique.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\xname adds double underscores, so we don't have to spell those out literally, and it takes care to add some small amount of whitespace so the two characters don't run together. I'm not sure if that motivation is ultimately justified, it's just a thing we have.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we should use \xname and \mname everywhere we currently have two literal underscores in C++ identifiers.

and \tcode{end(__range)}, respectively, where \tcode{begin} and \tcode{end} are looked
up in the associated namespaces~(\ref{basic.lookup.argdep}).
\begin{note} Ordinary unqualified lookup~(\ref{basic.lookup.unqual}) is not
Expand Down