---------------
Christof Meerwald@blog.www

home
> blog
>> 794

translate to German (by SYSTRAN)

Weblog RDF feed, Atom feed

[previous] / [up] [overview] [down] / [next]

Sat Apr 20 14:40:44 2013 GMT: No Digit Separators in C++14

Fri Apr 19 20:19:08 2013 GMT: C++14 Taking Shape

Thu Apr 11 07:06:05 2013 GMT: auto - What type do you get?

If you have been to Roger's talk about auto and got confused by what type might actually get deduced, I have one more example to add to the confusion:

const int bar();
 
void foo()
{
  auto && var = bar();
  decltype(var)::error;
}

This was one of the examples he presented in his talk (and where the Visual Studio IDE couldn't agree with the Visual C++ compiler - Visual Studio thought it would be "int &&" and the compiler thought it would be "const int &&").

Now, you can also try this with a type other than int:

struct C
{ };
 
template const T bar();
 
void foo()
{
  auto && var1 = bar();
  decltype(var1)::error;
  
  auto && var2 = bar();
  decltype(var2)::error;
}

So what types do you get for var1 and var2?

Well, actually you should get "int &&" for var1 and "C const &&" for var2. Why do you get a "const" for one case and not for the other?

The reason here is because the C++ Standard says in 5/p6 "If a prvalue initially has the type "cv T," where T is a cv-unqualified non-class, non-array type, the type of the expression is adjusted to T prior to any further analysis."

Thu Apr 11 06:45:30 2013 GMT: DHCPv6 really working now on my Raspberry Pi

Actually, there was still a bug in dnsmasq 2.66rc1 which we managed to track down and Simon fixed it in 2.66rc5.

Sun Apr 07 20:38:11 2013 GMT: DHCPv6 on the Raspberry Pi

Just got DHCPv6 working now on my Raspberry Pi after upgrading to dnsmasq 2.66rc1 (raspian's dnsmasq 2.62 didn't pick up the statically configured IPv6 address for some reason).

Sat Apr 06 21:27:13 2013 GMT: Carmina Burana @ Royal Festival Hall

Just been to a performance of Carmina Burana at the Royal Festival Hall.

Fri Apr 05 23:04:07 2013 GMT: La Bayadère @ Royal Opera House

I have just been to a performance of La Bayadère at the Royal Opera House.

Mon Apr 01 18:16:04 2013 GMT: Weekend in Amsterdam

Sat Mar 30 19:06:27 2013 GMT: ISO C++ issue lists imported into roundup trackers

Sat Mar 09 10:17:43 2013 GMT: Written on Skin @ Royal Opera House

Wed Mar 06 23:19:14 2013 GMT: Medea @ English National Opera

Sun Feb 24 21:44:58 2013 GMT: NetBSD 6.1rc1 on the Raspberry Pi

---------------

This Web page is licensed under the Creative Commons Attribution - NonCommercial - Share Alike License. Any use is subject to the Privacy Policy.

Revision: 1.14, cmeerw.org/blog/794.html
Last modified: Mon Sep 03 18:19:55 2018
Christof Meerwald <cmeerw@cmeerw.org>
XMPP: cmeerw@cmeerw.org