On Saturday, 15 September 2012 at 23:34:44 UTC, Jonathan M Davis
wrote:
On Saturday, September 15, 2012 16:29:32 Walter Bright wrote:
I wouldn't worry about it. I suspect that most C++ programmers
think that
references cannot be null. C++ is a complex language, and
invites
assumptions about it that are not so.
It's stuff like that that makes it so that I'll probably never
claim that I'm
an expert in C++ even though I'm probably one of the more
knowledgeable about
it where I work. Even if you think you know it really well,
there's always
_something_ that you miss.
- Jonathan M Davis
My favourite C++ wtf:
struct Foo
{
template <int x, int y> int fun(bool c) { return c ? x : y; }
};
struct Bar
{
int fun;
};
template <typename T>
int madness()
{
return T().fun<1, 2>(true);
}
The WTF: madness<Foo> doesn't compile, but madness<Bar> does
(with a warning).