« first day (184 days earlier)      last day (4766 days later) » 

Xeo
7:07 PM
Yay, iterator bug fixed
 
_SECURE_SCL is deprecated
in MSVC10
 
because the previous system was confusing so they replaced it
 
So is union A { int a; int b; }; A a; a.a = 0; int b = a.b; UB?
 
yes
 
7:14 PM
what about union A { int a; int b; }; A a; int *pa = (int*)&a; *pa = 0; int a1 = a.a; int a2 = a.b; ?
 
yes it is
just use a boost::variant, that's what it's for
 
what is the "active member" in the last example
 
the last one you wrote to
 
Uhm... @litb is present... have you taken a look at this question?
4
Q: Overloading function templates in namespaces

RolandWhy does this fail to compile with GCC 4.4? template<typename T> class A { public: void foo () { } private: T x; }; namespace Ns { template<typename T> void do_it (A<T> a) { a.foo (); } }; template<typename T> void myfun (T x) { Ns::do_it (x); } t...

 
@DeadMG what is the last one I wrote with *pa = 0
 
7:19 PM
My guess is that the issue is that the call to Ns::do_it is qualified, but I cannot find my way through the standard. A couple of simpler questions just to make sure that I am on track would be: is Ns::do_it dependent in:
template <typename T> void foo( T a ) { Ns::do_it(a); } ??
 
@Johannes: Presumably, a.a
 
why is it not a.b :(
 
seriously, it's a pointer to a.a, so when you write through the pointer, you write to a.a.
pointers 101
oh wait, I misread
well, it's completely undefined behaviour anyway because you can't cast union pointers like that
 
why can I not do that. Each non-static data member is allocated as if it were the sole member of a struct.
A pointer to a standard-layout struct object, suitably converted using a reinterpret_cast, points to its initial member (or if that member is a bit-field, then to the unit in which it resides) and vice versa.
also, there is similar wording in C
 
nobody cares about C
 
7:24 PM
it looks like it's a pointer to the union member object. so when I write to it, I create an int. Why would it be connected to either member?
how is the connection established
im just researching
 
and you can't do that because you've got a pointer, but it could point to any of the union's members
 
right. but since both are int, it will point to both members.
 
pretty sure that one pointer points to one object
 
If an object of type T is located at an address A, a pointer of type cv T* whose value is the address A is said to point to that object, regardless of how the value was obtained.
 
an object
 
7:25 PM
there can only be one object. two members of an union can share the same object
so if both the int members share the same int object (if they don't, then we will point to two objects of the same type with the same address. not allowed!).
 
this is why unions are bad things
you have to be a Standardese expert to understand anything that's safe or unsafe with them
 
template <typename T> struct A { void foo(); };
template <typename T> struct B { void bar(); };

namespace x { template <typename T> void do( A<T> ); }
template <typename T> void myfunc( T t ) { x::do( t ); }
namespace x { template <typename T> void do( B<T> ); }

int main() {
   B<int> b; myfunc( b ); // fails to find x::do( B<int> )
}
 
this reminds me I wanted to do a FAQ entry for lookup of dependent function names
 
if unqualified lookup is used, everything is nice and easy, with qualified lookup it fails
 
yes. qualified lookup does not consider declarations at the instantiation context
both because ADL would not be active and because it's explicitly stated that it doesn't
 
7:34 PM
Also, I have seen another funny effect, changing that to unqualified, and adding using namespace x; outside of main, compiles, but if the using namespace x; is inside main, it does not compile
 
GCC is known to occasionally consider unqualified names when it shouldn't do so
maybe recent GCC versions improved
 
A different test I tried was dispatching the `myfunc` template to a different template in the same namespace:
namespace x { template <typename T> void myfunc( T t ) { do( t ); } }
template <typename T> void myfunc( T t ) { x::myfunc( t ); }
I would have expected this trick to work, since the x::myfunc is declared above the declaration of ::myfunc, so that there can be no problem there, and then when the user calls myfunc( B<int>() ), it would instantiate ::myfunc, that would in turn instantiate x::myfunc, that would use unqualified lookup to locate x::do( B<int> ), again no success
BTW, VS2010 accepts the code, but that I would expect due to the late "processing" of templates in VS
 
@JamesMcNellis lulz :P
 
If not fixed, blame Java.
 
@PiotrLegnica true that! If that doesn't solve it, use a hammer :P
 
Nothing says 'hello world' like a good hammering.
 
8:28 PM
@PiotrLegnica What's getting hammered? Is that the same as getting smashed?
 
Whatever you like most.
Feel free to ignore any of my statements that don't make any sense, half of my mind is asleep and the other half is going 'portalportalportalportal'.
 
@PiotrLegnica suffered from that kinda thing all damn day :P
 
@PiotrLegnica is Portal 2 going to be much longer than the first one? I recall waiting for it just to find out that it was quite short...
 
@DavidRodríguezdribeas Well, if it's not, then Valve will have to defend itself from a raging mob wielding torches and pitchforks. Every bit of information thus far indicates that it will be, though.
Some people say first Portal was more of a techdemo for Portal 2.
 
@Piotr: Then those people are idiots
Portal began as a tiny, tiny indie game developed outside Valve
 
8:35 PM
Well, I liked it, I don't really care. :P
Yeah, Narbacular Drop.
 
never played it, personally
 
It was about a princess without knees.
 
but it's difficult to see someone starting with that concept as a tech demo
 
And a sentient dungeon, or something to that effect.
 
especially as the tech of Portal is way behind what's available in UE3 or CryEngine3
Portal doesn't have anything you couldn't see in any old Source game
 
8:37 PM
Except for portals. :P Anyway, I think first one was fun in both gameplay and story, even though short.
Oh, and Portal 2 has co-op multiplayer.
 
Portals aren't exactly graphically incredible
nothing you couldn't achieve with a little hardware instancing
 
wow, where is @sbi, has he been here at all tonight?
 
'talked 9h ago', according to almighty user info panel.
And 10 more hours to go, oh how I hate waiting. It's killing me.
 
@PiotrLegnica for what?
 
Portal 2 release, or at least that's what the damn countdown says, so I hope they actually will.
 
8:47 PM
@PiotrLegnica is that the game
hello @Potatoswatter
 
@TonyTheTiger hiya
 
only 10 hours?
less than I expected
 
@Potatoswatter what's new?
 
@TonyTheTiger just reading about the big bang, don't think that counts
 
8:50 PM
@Potatoswatter that's not really new per se, its as old as anything
@Potatoswatter hope they not bangin' on about it too much
 
@TonyTheTiger Yes, I wouldn't appreciate a new big bang. Happy with the one we've got.
 
@Potatoswatter heheh :P true
 
Xeo
/random
 
Someone ninja'd the conversation.
 
@Xeo How is that attached to the cinderblock, and won't it damage the fabric?
 
Thanks! Answers: Might not work with most cinderblock, might incur damage fines, likely to damage fabric.
 
@Potatoswatter ye kinda a makes sense you know
 
Might indicate a ninja.
 
@PiotrLegnica Make a good ninjacator?
 
Xeo
now that's what I call earphones:
 
9:04 PM
I think I'll go play some DCSS, because I don't think I'll be able to fall asleep tonight.
 
@Xeo that's pretty awesome
 
hi
 
Xeo
hey GMan
 
@GMan Already awake? :P What time did you go to bed this morning?
 
9:08 PM
@DavidRodríguezdribeas I slept from something like 5:30am to 8:30am.
Then school.
 
@GMan Sleep is a disease caused by <strike>Mt. Dew</strike> caffeine deficiency!
 
@JerryCoffin I had three red bulls and they didn't help. :(
 
Sleep is good.
 
I so miss Mt. Dew!
I have only found it here in an importer at something like 1.5€ per 33cl can
 
@DavidRodríguezdribeas Youch -- maybe I should go into business exporting it. I had to quit -- turns out it (and caffeine in general) irritates gout.
 
9:13 PM
Has MSVC got a warning for wrong order in the initializer list? I can't seem to find it.
 
@GMan Hmm...sounds like you're really sick!
 
lol
 
sbi
@TonyTheTiger Following Elton John's advice, I took my mama out tonight. :) We went to see a wonderful movie, had a grand evening, and I just made us some strong Caipirinhas. :)
 
are default types for templates really as simple as they look?
taking that as an example...
 
@thecoshman They are known to eat unsuspecting people.
 
9:24 PM
@PiotrLegnica hmm... how so?
 
@PiotrLegnica I don't think so. My friend got bitten by it once and I'm pretty sure he had full warnings on.
He better have...
 
@thecoshman bad joke. :P
 
@thecoshman Yes.
Well, on classes anyway. Not allowed on functions, for whatever silly reason they came up with. Restriction is lifted in C++0x, though.
 
@GMan yeah... that is a strange restriction. I do love 0X
 
@sbi Why Elton John?
 
9:30 PM
What I don't understand is why we weren't allowed to work around it using default arguments:
template< typename T >
void f( T = 0 ) {}
 
@Potatoswatter I think the reason you can't do that is because the blocked default arguments.
 
is there any consensus as to weather templates should use 'typename' or 'class' I think typename is nicer
 
@GMan My meaning is more like, why did they disallow it
 
@thecoshman I use typename, since it is, in fact, a typename.
@Potatoswatter IIRC, because they weren't sure if it would cause problems/be useful.
 
@GMan it is what makes sense to me :P
 
9:34 PM
@thecoshman Sometimes I use class if I know the type will be a class, such as for traits
 
@Potatoswatter Perhaps a more technical problem is the cause, though. For example, if we have template <typename T> void f(T = 0), and we do f(), it really has to transform that into f</*supplied/deduced arguments*/>() before it can then do the default arguments: f<...>(0). In other words, it has no idea what T should be without looking at defaults, but defaults aren't looked at until it knows what T is.
(Of course, the way default arguments are handled could be changed.)
 
@GMan Agreed. It would really suck for the compiler. Oh well :vP .
 
oooh, so the type of a template becomes part of the scope, so you get foo<T>::bar(); for writing the functions
makes sense when I think about it :P
 
9:51 PM
int main() {[](){}()}
 
sbi
@GMan I once showed that to Scott Meyers. It took him a while until he puzzled it out. :)
 
Haha.
OH DEAR LORD.
I wanted to print a single page of a 1,322 page PDF.
But failed to change it to "Current page".
Luckily I saw and canceled it once it started doing more than one page.
 
That is not really an issue, there are already a bunch of non-deductible types, that would just be one more to the list, where the user is forced to provide the type manually. In other cases it would not even be the case:

template <typename T> bool value( std::string const & attr, T& value, T const & def = T() ) {
// read a value from the config[attr] into value, use def as default return whether the value existed
}

Granted that I would not actually write the function like that, but anyway it is *an* example
 
@DavidRodríguezdribeas Right, deductibility is the issue. My example is legal, just not useful.
* deducibility. Tax time is over :vP
 
lol
 
10:13 PM
erm... if I had a template class... what would be a good way to go about allowing conversions from say foo<float> to foo<int>? Would I need to manually write conversion functions for all types my self manually?
 
Yes. Of course, you should justify why such a conversion is necessary anyway.
 
@thecoshman template< class U > foo::foo( foo< U > const& );
 
@Potatoswatter is that going to so what I want?surely I need something more like foo<int>::foo(foo<float> const&);
 
@thecoshman: it really depends what exactly you want
 
A 'simple' way to let the physics work with double precision vectors but convert them to floats for the graphics to render from
more of a curiosity to be honest
 
10:22 PM
bah, I mixed class and namespace scope syntax. template<typename U> template<typename T> foo<T>::foo( foo<U> const& )
 
hi
 
hi
 
erm... I thought if I went template<class t = float>class Foo{}; I could just go Foo f and by default it will be of type float?
hi @jalf
 
@thecoshman template <typename T> struct vec { template <typename U> vec(const vec<U>& o) : x(o.x){} T x; };
 
10:23 PM
@thecoshman I wouldn't do that. I'm not even sure if it would require Foo<> f
 
@thecoshman Needs to be Foo<> f;.
Better is to not default, though.
 
@GMan that's the way to do it… i was trying to capture too much in pseudocode
 
There is no sensible default value type for a vector; perhaps for your application, but not as a general utility.
 
@GMan dam. I was hoping I wouldn't have to go through the code base and convert it all to use the template version ¬_¬
 
Anyway that's what typedef is for.
 
10:24 PM
@thecoshman You should use typedef's.
Baw, ninja'd.
 
But a true ninja clicks the arrow…
 
oooh, typedef Foo Foo<float> you mean? or is it the other way around typedef Foo<float> Foo
 
@thecoshman template <typename T> struct vec {}; typedef vec<float> vecf; typedef vec<double> vecd; typedef vec<int> veci; etc.
@thecoshman Neither, the identifier Foo is already taken. (But the latter, if it were to work.)
 
@GMan hmm...
 
I suck at DCSS.
 
10:27 PM
@PiotrLegnica "I suck DCSS."
 
#define MAKE_VEC(INITIAL, REM) typedef std::vector< INITIAL ## REM > vec ## INITIAL;
 
@thecoshman You could name a template BasicFoo or something, and make Foo a typedef then.
 
@PiotrLegnica I think I might just go through and change it all my existing Foo to Foo<float>
 
typedef int qwerp;
 
@Potatoswatter I'm pretty sure it's a mathy vector, not a container vector @thecoshman is talking about. :P
 
10:29 PM
MAKE_VEC( q, werp )
@Piotr: Free functions make bare structures look like whatever you like :v)
 
@PiotrLegnica it is indeed a 'mathy' vector :P
I think I am just going to have to leave this for another time. deadlines are too close to arse around with all this. source control to the rescue!
 
I'm hungry.
 
@thecoshman: Note that std::inner_product makes arrays, std::vector, std::deque, etc more "mathy"…
 
@Potatoswatter Thanks for the correction
 
hunger.~Hunger(); <= does not free more space
 
10:36 PM
:|
 
The medical website says it will take an entire year for my toenail to fall off…
 
wat
 
why do you want your toenail to fall off? :|
 
I have no choice, it's merely very likely. Grand Canyon kicked my… toes.
 
oh
kick right back at it, imo
show it who's boss
 
10:39 PM
That's how this all started…
 
@Potatoswatter the git!
 
@thecoshman ?
 
@Potatoswatter that big Canyon thinking it can push around who ever it wants
 
@thecoshman That canyon is just a whole lotta nothin'.
 
a big hole in the ground
 
10:47 PM
@Potatoswatter ¬_¬ I'm going to get pedantic and proclaim the floor in your logic
 
@thecoshman Oh yeah? Yo' mama's heavier than the Grand Canyon!
 
@Potatoswatter Oh yeah? Yo' mama's so fat, rather then falling into the Grand Canyon she just rolled over it!
 
@thecoshman How dare you insult my mother? The grand canyon is just a weightless void.
Lol, see who left… I guess it's getting dumber in here, sorry :v(
 
@Potatoswatter no it's not. It is the very rock it is carved from.
 
@thecoshman The rock it was carved from got washed down the river…
 
11:02 PM
which even if you took just the very surface layer of molecules, is an vastly superior weight then my mother. Or we could consider the air that fills the region that was carved out by the rock
@Potatoswatter but that silt is not what makes the GC, the GC is defined by its surface
 
@thecoshman The surface geometrically defines a volume, and I can pick a reason not to weigh the air. Anyway…
 
@potatoswatter with out its walls, and celling etc, your house is nothing but a region of land.
@Potatoswatter yes any way...
¬_¬ stupid needing to get to bed so I can get up early so I can be ready for stupid exam...
night :D
 
@thecoshman gnite and good luck!
 
@Potatoswatter cheers :D
 
11:38 PM
Ain't my house beautiful?
 
@JerryCoffin It's hard to get a sense of scale, but I'm guessing it's bigger than it looks.
Or is that actually the site where you are going to build a new house?
 
@Potatoswatter No -- I've been living in the house for a couple of years now, but that is the hole they dug for the basement. Let's see if I can dig up a pic of the house closer to finished.
This is when the outside walls were pretty close to done, with my wife and kids (and a giant dumpster, of course) in the foreground to (perhaps) give a better sense of scale. But now it has those floors and walls and stuff to get in the way of seeing what @thecoshman was calling the house...
 
@JerryCoffin That's more like it :v) . Can't imagine what it's like to visit your own house like that…
 
@Potatoswatter It was pretty cool -- to be honest, I have pictures about two or three times a week the whole time it was being built. :-)
 
@JerryCoffin Sounds about like I would do, lol
 

« first day (184 days earlier)      last day (4766 days later) »