--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-proposals/.
On 2016-02-19 15:06, Patrice Roy wrote:
> I often use _ as «uninteresting but needed» variables such as lock_guards.
> Please don't break my code :)
I don't think this would break your code (except that using '_' is
probably a no-go due to its use for GNU translations). The idea is that
the variable exists, but cannot be named, and isn't used except for side
effects. A lock_guard is certainly a side effect. (Critically, the
lifetime of such a variable is not different from a regular variable.)
Hmm... I wonder if `.` could be used...
--
Matthew
On Sat, Feb 20, 2016 at 4:11 PM, 'Jeffrey Yasskin' via ISO C++
Standard - Future Proposals <std-pr...@isocpp.org> wrote:
> I do still think that __ is the most likely
> name for the concept.
I'd rather see a syntax like `if` but not branching:
with (locking()) {
// ...
}
with (auto f = open_file(...))
// ...
For this use case,
for(auto _ : {1, 2, 3})
{
}
I think, maybe, we can just allow range-for to have no declarator:
for ({1, 2, 3})
{
}
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/20160222234646.4898897.70283.5544%40gmail.com.
From: Patrice Roy Sent: Monday, February 22, 2016 7:27 PM |
(¹ See Viacheslav Usov's most recent post re: lifetime extension for a
contrary opinion - so far, the only one expressed in this thread.)
Hi!
Does anyone see helpfulness of such solution:
for(auto _ : {1, 2, 3})
{
}
Variable with name "_" has an implicit unused attribute set.--Dmitry Banschikov
On 2016–02–24, at 12:03 AM, Matthew Woehlke <mwoehlk...@gmail.com> wrote:On 2016-02-23 10:49, Viacheslav Usov wrote:On Tue, Feb 23, 2016 at 4:41 PM, Matthew Woehlke wrote:...wasn't there a proposal floating around to do that automatically,
though?
I am not aware of a such a proposal; any pointers?
http://wg21.link/n4221 ...and you may want to ping David Krauss (CC'd)
as to what ever happened with it, as I don't recall offhand.
If that proposal pins a temporary to the scope when it is used in some
particular way, then perhaps it would be equivalent. But then one of those
"particular ways" should include something that the equivalent of
{
@std::lock_guard(mutex);
// do things
}
were easily expressible.
I don't think it tried to cover this; only where the entity was still
accessible, albeit indirectly or only partially.
On quarta-feira, 24 de fevereiro de 2016 08:31:53 PST 'snk_kid' via ISO C++
Standard - Future Proposals wrote:
> If that's not possible due to
> conflicts with existing code that has _ variables then use another symbol?
It's about 40 years too late to change the meaning of _. Using other symbols
has the problem that we're out of characters from the basic character set.
The symbol characters allowed are:
_ { } [ ] # ( ) < > % : ; . ? * + - / ^ & | ~ ! = , \ " ’
All of those are already in use.
We'd need a compound identifier (more than one character), like digraphs do.
auto = <insert expression here>;
On 2016–02–27, at 1:07 AM, T. C. <rs2...@gmail.com> wrote:Assuming that lock_guard is a type, `lock_guard(mutex);` is a declaration of a lock_guard called 'mutex' (which is error because you can't default-construct a lock_guard).If you want this to work, you'll have to change the disambiguation rule too.