Thursday, September 18, 2014

Digest for comp.lang.c++@googlegroups.com - 4 updates in 3 topics

comp.lang.c++@googlegroups.com Google Groups
Unsure why you received this message? You previously subscribed to digests from this group, but we haven't been sending them for a while. We fixed that, but if you don't want to get these messages, send an email to comp.lang.c+++unsubscribe@googlegroups.com.
"AP" <unixpronospam@verizon.net>: Sep 18 04:39PM -0400

http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf
 
says that
 
"In addition, this rewrite adds the restriction that lambda expressions
cannot be used in the operand of a sizeof operator, alignof operator, or
decltype specifier. That restriction—
suggested by Doug Gregor and John Spicer—avoids severe implementation
difficulties with template argument deduction (e.g., this avoids the need to
encode arbitrary statement
sequences in mangled names)."
 
And yet this snippet compiles and runs just fine :
 
#include <iostream>
int main()
{
auto lambda=[](){ return nullptr;};
std::cout << sizeof lambda << std::endl;
return 0;
}
 
Is it wrong to read the open-std papers ?
 
 
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
 
 
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Victor Bazarov <v.bazarov@comcast.invalid>: Sep 18 07:20PM -0400

On 9/18/2014 4:39 PM, AP wrote:
> return 0;
> }
 
> Is it wrong to read the open-std papers ?
 
In your code 'lambda' is an object, the lambda-expression is the
expression between the '=' and the semicolon that ends the declaration
statement. What you're not supposed to do is to write
 
.... sizeof []() { return nullptr; }
^^^^^^^^^^^^^^^^^^^^^^^^^
That is a lambda-expression. It cannot appear as an argument of
'sizeof'. It's pretty much useless there, if you ask me...
 
V
--
I do not respond to top-posted replies, please don't ask
"AP" <unixpronospam@verizon.net>: Sep 18 04:33PM -0400

What is wrong with it ? I'm trying to digest Exceptional C++ on the subject
and can't get it ...
 
 
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
 
 
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
"AP" <unixpronospam@verizon.net>: Sep 18 04:31PM -0400

And then people wonder why the obesity in trolls ...
 
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
 
 
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: