Joseph Turian wrote:
F.J.K. wrote:
Apart from that: don't use
_options. Qualifiers with leading _ are reserved for the compiler +
implementation.
Could you please explain?
What do you mean by qualifier, precisely?
Using underscore anywhere, even member variables, is deprecated?
17.4.3.1/3
If the program declares or defines a name in a context where it is
reserved, other than as explicitly allowed by this clause, the behavior
is undefined.
17.4.3.1.2/1
Certain sets of names and function signatures are always reserved to
the implementation:
Each name that contains a double underscore (_ _) or begins with an
underscore followed by an uppercase letter is reserved to the
implementation for any use.
Each name that begins with an underscore is reserved to the
implementation for use as a name in the global namespace.
So using a name (whether it be the name of a variable, function, type,
namespace or anything else) yields undefined behaviour, which is a
completely different concept to being deprecated.
In your code you had a member variable called _options. As a member
variable, it is not in the global namespace. The name exists only
within the scope of the class. So the second part of 17.4.3.1.2/1 does
not apply. And nothing about the first part of 17.4.3.1.2/1 applies
either. So in this case F.J.K. was wrong and your code is fine.
However, rather than having to remember exactly which rules apply where
(I had to look it up again to check before I worte this post) many
people, myself included, prefer simply to avoid leading underscores
altogether. Note that, for example, if your member variable had been
called _Options, the first part of 17.4.3.1.2/1 would apply and you
would not be allowed to use that name.
Gavin Deane