« first day (915 days earlier)      last day (4048 days later) » 

10:00 AM
Just see what other people follow.
 
user142019
isocpp occasionally links to random Stack Overflow posts.
 
@weirdhistory is hil-- oh wait, C++.
 
user142019
Why was RollerCoaster Tycoon written in assembly. .—.
 
user142019
Insane!!
 
I'm doing quite good seeing I've only slept 4 hours last night
 
10:05 AM
Hello there!
 
Ohai!
 
user142019
Hello there!
 
    template <typename... T>
    struct TestRunner
    {
        template<template<typename...> class C1, template<typename...> class C2, template<typename...> class... Cs>
            static void dispatch()
        {
            ContainerTests<C1>::template run<T...>();
            dispatch<C2, Cs...>();
        }

        template<template<typename...> class C>
            static void dispatch()
        {
            ContainerTests<C>::template run<T...>();
        }
    };

    int main()
    {
^ template wankery, am I doing it right?
 
user142019
@sehe variadic variadic template templates? :'(
 
user142019
10:07 AM
That's too variadic for me!
 
@sehe Why head-neck-tail instead of head-tail?
 
My latest SQL accomplishment: http://data.stackexchange.com/stackoverflow/query/109087/users-that-get-the-most-passive-rep

This guy hasn't posted an answer in almost a year. And he's been repcapping almost every day since.
 
@Tony The Lion Thanks man, your answer shows effort. Well, I just wanted to ask you, how do you understand these assembler instructions ? Does it require the knowledge of assembly language ? If yes, then please suggest me a good book to learn assembly language from the beginning. Thanks again! — Rage Apr 8 at 4:46
 
@R.MartinhoFernandes I always get mixed up there. This was the one incantation I could get to works. If you care to ... un-stuck me?
 
lol, well, I learned assembler is the answer, I mean, how else would I understand these asm instructions
 
10:08 AM
@sehe Get rid of C2.
 
@R.MartinhoFernandes It lead to ambiguous overloads IIRC. Lemme check again
 
@Mysticial I guess with 200k rep that isn't so hard to fathom
 
user142019
I get about ten/fifteen passive rep every day. If you have ten times as much as me, I wouldn't be surprised you hit the cap every day.
 
Xeo
@Mysticial Holy crap
 
not fair
nobody upvotes old AWESOME C++ language answers
 
10:14 AM
@Mysticial: Interesting. SO gives you access to their DB?
 
@Xeo Holy cap (ftfy)
@wilx Everyone. You can even just download all Q&A (there are official torrents too)
 
And related question, would it not be more efficient to not create the temp tables and instead make one huge query? Execution planning wise?
 
@wilx I'm very new to SQL.
 
@wilx ... you're optimizing a public facing data mining web app?
 
Before I started playing with the data explorer, I knew zero SQL.
 
@R.MartinhoFernandes well, the individual subcases are queued, but they will prolly never run
 
@wilx You can always check it yourself. They let you request the execution plan...
 
@R.MartinhoFernandes Also did my link WRT 4.8 help?
 
@BartekBanachewicz Seems they are having some trouble with the infrastructure.
 
@R.MartinhoFernandes aha. Well, it's a free service, I didn't really expect fireworks.
Also they explicitly stated they support 4.6 :)
 
10:17 AM
Most of the stuff seems to be index scans.
 
@R.MartinhoFernandes what is this?
 
That's good, right?
 
I think so
 
@BartekBanachewicz Execution plan (well, part of; I am not bothering to piece a full screenshot) for Mysticial's query.
 
that's a nice diagram indeed
I'd never ever want to do DBA stuff though.
oh, also, wanted to ask
did you manually add black border to ogonek logo in favicon?
 
10:21 AM
Yes.
Was very hard to discern otherwise.
I painted all the pixels myself.
 
Yea, I figured, just forgot about it and you said that it was k back then
@R.MartinhoFernandes in what editor? :3
 
Don't remember, but probably paint.
 
There's one free editor for pixelart, I gotta get it someday
pixelart is nice if you have 0 artistic capabilities like me
 
@R.MartinhoFernandes Hmm. I don't see it. the version that works, the version without C2 (changed lines #69,#73 only) says:
main.cpp:73:17: error: call of overloaded ‘dispatch()’ is ambiguous
 
That's weird. I would have expected the non-variadic to be preferred (@Xeo?).
Well, head-tail / empty should work :P
 
10:23 AM
@R.MartinhoFernandes Me too, actually. Lemme compare clang.... It also flags the error
 
that's the highlight of my artistic capabilities
I'll just leave it there for you to laugh at
 
@BartekBanachewicz You know that, without the self-demeaning comments, no-one would have laughed at that
 
That's leagues better than anything I ever drew.
 
@sehe what? no, really, one has to accept one's flaws. I can't draw for shit
 
Stop trying to suck.
 
10:26 AM
@BartekBanachewicz That's irrelevant
 
I even suck at sucking :/
 
Xeo
@R.MartinhoFernandes Well, current standard actually is ambiguous in that regard, but that's a defect. common_type relies on that defect being fixed.
I wonder how libstdc++'s common_type is implemented
 
@BartekBanachewicz I do actually like that
@BartekBanachewicz no, pixel art is shit if you are shit at art
 
@R.MartinhoFernandes Hmm. I just realized, the problem is likely that the template arguments are explicit, never being deduced (i'm using packs as typelists here).
 
@thecoshman well, if you want to do animation for example, then sure
 
Xeo
10:27 AM
@sehe Doesn't matter
 
I can't really do template<> void static dispatch() {};, can I?
 
but for small icons, for example, working at 800% magnification is comforting for me
 
Xeo
partial ordering doesn't care about explicit or deduced args
@sehe no
 
5 mins ago, by R. Martinho Fernandes
Well, head-tail / empty should work :P
Well, then ^ doesn't really apply
 
@BartekBanachewicz no, pixel art is shit if you are shit at art
 
10:29 AM
@sehe Why not?
 
googled for pixel art, was not dissapointed /cc @EtiennedeMartel
 
Xeo
template<class...> types{}; and overload on types<Arg, Args...> vs types<> :P
 
@TonyTheLion that's some weird hat
 
@TonyTheLion WTF No, I don't get the point of a PNG wall of text.
 
10:31 AM
@Xeo I'd say the current is about as legible. Albeit your verbosity trick expresses intent more
 
user142019
@Mysticial T-SQL, then. :P
 
1 message moved to bin
 
@R.MartinhoFernandes Can't help that someone on Reddit made a .png with text
 
@sehe you interrupted me in half :/
 
@Zoidberg T-SQL?
 
10:31 AM
some people are stupid
 
user142019
@Mysticial Microsoft's dialect.
 
get over it and read the damn text
 
@R.MartinhoFernandes Because:
    template<template<typename...> class C1, template<typename...> class... Cs>
        static void dispatch()
    {
        ContainerTests<C1>::template run<T...>();
        dispatch<Cs...>();
    }

    static void dispatch() {}
 
@Zoidberg ah
 
@TonyTheLion I'll get over it and keep debugging.
 
10:32 AM
The dispatch<> would never find non-template overloads?
 
@TonyTheLion use OCR dammit, we're not in 20th century anymore
 
user142019
No enough variadic variadic variadic template template templates.
 
Xeo
@sehe Except you have the extra neck :P
 
@BartekBanachewicz I didn't create the damn png
 
@Xeo "neck"?
 
10:33 AM
@TonyTheLion yeah, but converting it to text should be trivial
 
Xeo
@sehe C2
 
@BartekBanachewicz seriously, you want me to waste my time trying to get OCR to work properly over just posting the damn png. I mean, it reads exactly the same. I don't see what advantage that gives?
 
@Xeo lemme visualize the types<> solution to be able to compare better
 
@TonyTheLion Well, it's less readable and takes more space. Anyway, I'm just being picky, so ignore it. The text was meh anyway.
 
Xeo
Hm, thinking about it, you'd rather need template<template<class...> class...> templates{};
 
10:34 AM
I don't really care about the content, but I object to "reads exactly the same"; not everyone has healthy eyes.
 
get glasses
 
Xeo
And then templates<C1, Cs...> vs templates<>
Of course, one could also reuse types through template<template<class...> class> struct tmp{}; and then types<tmp<C1>, tmp<Cs>...>
But I'm getting on a tangent here
 
@TonyTheLion I wear glasses normally, in case you haven't noticed on my av.
 
@Xeo indeed. i just noticed
31 mins ago, by sehe
^ template wankery, am I doing it right?
:)
 
Xeo
And anyways, it's just GCC being sucky
 
10:38 AM
(allthough I suspect {} is redundant there - it doesn't need to be a complete type, right?)
@Xeo and Clang
 
Xeo
@sehe It does, as a function parameter and argument
Unless of course you want to pass a casted nullpointer, but really...
 
@Xeo Wait, when is it gonna be a function argument again - this is quickly turning into a much much uglier solution, I feel
 
@LightnessRacesinOrbit Johannes gets 14/day passive. So isn't zero for passive rep. But still a far cry from the web-programming tags and .
 
@BartekBanachewicz that wasn't aimed at you, but at the robot complaining about his eyes just above that comment
 
Konrad gets 10/day. But he also does . Not sure how it's being split across the tags.
 
Xeo
10:40 AM
template<template<class...> class C, template<class...> class... Cs>
void dispatch(templates<C, Cs...>){ /* ... */ dispatch(templates<Cs...>{}); }
void dispatch(templates<>){}
@sehe ^
@sehe Which version?
 
@TonyTheLion oh sorry didn't notice
@Mysticial ohoho, passive rep query?
 
@Xeo Ubuntu clang version 3.2-9 (tags/RELEASE_32/final) (based on LLVM 3.2)
 
@BartekBanachewicz Yeah.
 
@Xeo ahem. So, that's you agreeing with my :
15 mins ago, by sehe
@R.MartinhoFernandes Hmm. I just realized, the problem is likely that the template arguments are explicit, never being deduced (i'm using packs as typelists here).
 
Xeo
@sehe No
 
10:42 AM
I'm willing to hide this somehow, but I'm not willing to pass a dummy struct instance in the external interface just to workaround an implementation detail
 
Fred has 8/day. And that's all from . A good chunk of those are also from his questions.
 
Xeo
If the compiler implemented the defect report resolution (which they really should), you should be able to just use template<class C, class... Cs> vs template<class C> (using just class here for brevity)
 
This one is more efficient, no temporary tables.
 
@wilx Oh cool. thx :)
 
@Xeo That's good to know. I'm still mogrifying into your suggested workaround just for exercise
 
10:45 AM
@wilx How much faster is it?
 
6851 ms vs some 24000 ms of yours.
 
@BartekBanachewicz it may have taken me like a half hour to work through them, but finally got them all :)
 
@wilx Woah... That's a big difference. :)
And that's all from just the temporary tables?
 
According to that, I get 32.667 vs. 34.667 (passive vs. active) rep/day.
Hmm. That's way more passive then I'd have guessed. What is the sample? All-time?
 
I would've though all the joining and grouping crap would take longer.
 
10:48 AM
Databases optimize. That's what they're good at
 
@sehe Last 30 days only.
 
@Mysticial Databases are built to optimise for those cases.
 
@Mysticial Aha. Makes more sense
 
@thecoshman good job! That was a nice fun in normal C++ coding spree for me.
 
I filter the votes with this: DATEDIFF(DAY,Votes.CreationDate,@lastDate) <= @window
 
10:48 AM
@Mysticial We should add the 'passivity ratio' metric for ranking :|
 
@BartekBanachewicz some of them I even knew of the bat :) the tricky ones for me where the exact order things get con/de-structed. It's not something I ever really thought about much
 
@sehe I thought about doing that. But the # of columns was getting a little high. :)
But yeah, feel free to fork it.
 
Xeo
Notes from the October, 2012 meeting:

CWG agreed that the example should be accepted, handling this case as a late tiebreaker, preferring an omitted parameter over a parameter pack.
 
I might. Too busy now
 
10:50 AM
@thecoshman that's why I said it was better than most interview questions
 
@Xeo Thanks
@Xeo Shit. Deja vu - from that wording I realize I read that one before
 
@BartekBanachewicz would be a strange interview if they just sit you down with that :P
 
Xeo
Although it does seem Clang 3.3 Trunk still doesn't do that for template parameter packs, only function parameter packs
Hm
 
@Mysticial: Actually, I was wrong. You query says "1000 rows returned in 43109 ms". Even bigger speedup.
 
woah
 
11:00 AM
in C, what happens when you do return a ? : b; where you leave the true case out?
apparently the compiler doesn't bark at that
seems its a compiler extension in GCC and LLVM too, it picks a if you leave out the middle operand and a is true
 
Xeo
what
 
@Xeo a? a : b with a evaluated once.
 
Xeo
Hmm
 
Same thing, but sorted by "active". Also applied @wilx's optimization.
 
11:04 AM
@Xeo Okay, here's my aesthetics gripe with that: ideone.com/Mt0DFR
I really prefer the first variant. I will still keep using the types<> trick for a while, because it's easier to remember/get right (at least until compilers implement the DR)
@Mysticial Hmmm is there something wrong? Jon Skeet: 1013.267 passive rep /day?
 
@sehe Looks correct. He gets over 100 passive upvotes a day.
 
Probably ignoring the rep cap.
 
Yes, ignoring repcap.
 
@Mysticial That's forgetting about the rep cap then
....
 
It wasn't going to be easy to take into account for that.
 
11:06 AM
So it's measuring castles in the sky
 
Pretty much anybody who averages over 300 rep / day will be repcapping every single day except for really bad days.
 
> re.UNICODE does not magically turn on unicode, it just changes the meaning of \w
Well done, Python.
 
Hmm...
 
@TonyTheLion the assembly output you provided has nothing to do with the source code. {int foo; return 0;} should be compiled as return 0;, without any local variables. it just happened that your compiler injected a lot of other instructions. — Abyx 41 mins ago
seriously? I was trying to show what happens, why are you nitpicking???
 
@Mysticial Cpt. Obvious?
 
11:10 AM
@thecoshman oho.
 
Just received a Haskell job offer. (Well, from recruiter office..)
 
@sehe Not necessarily. Assuming a Poisson distribution centered at X. X would have to be somewhat significantly above 200 to make sure you almost always repcap.
 
@StackedCrooked Take up offer, get job, profit.
 
@Mysticial Okay, granted. It's just obvious to me (and the other 99.9% of SO users that don't get 100+ posts like you)
 
I don't want to switch jobs now.
 
11:12 AM
-2
A: Why is a pointer needed for initialising an object on the heap, but not on the stack?

AbyxIf variable is allocated on stack, compiler implicitly generates a pointer for you. i.e. Object myObject1; myObject1.foo(); will be compiled as Object* myObject1_implicit_ptr = new(alloca(sizeof(Object))) Object; myObject1_implicit_ptr->foo(); (alloca allocates memory on stack)

 
@StackedCrooked You know Haskell?
 
oh my, -2 in few seconds ^
 
Haskell lives in Gent
 
@R.MartinhoFernandes Not beyond tutorial level.
It's only a 6 month project.
But it's good news too see that Haskell jobs do exist.
 
Hmm... If I wanted to take into account the repcap, I'd first have to group and collapse by UTC day. Then cap at 200. And then proceed to collapse by user... And to take into account for posttype and community wiki... oh god.
I'm not even gonna try.
 
11:15 AM
@Abyx I would agree with the comment that your answer will probably only confuse OP
 
@Abyx You are missing the point. Completely. The idea was to describe to the OP how the compiler generates the assembly which describes the memory requirements of a given program. Not the specific one, nor to describe optimization possibilities and approaches. — Domagoj Pandža 10 secs ago
 
@TonyTheLion what you showed are ~30 instructions which are unrelated to that local variables question
 
@StackedCrooked the proof of the pudding...
@Mysticial Or dump into csv and do that grouping locally
 
@TonyTheLion yeah, and your push edi, ..., mov eax, 0cccccccch, rep stosd, pop edi didn't confuse OP. I see...
 
Nothing wrong with confusing people!
3
:)
 
11:24 AM
@Abyx The OP asked to explain the gritty details that go on behind the scenes. The OP of your question asked the C++ level distinction between objects on the stack and on the heap. Instead of doing intermediate steps of the compilation, you should've just discussed automatic storage duration and such.
Also, I just got friendzoned by a hawt Jedi in KotOR because I'm evil.
 
@DomagojPandža meh, there is no "automatic storage duration" behind that scenes. what actually happens is the alloca call instead of malloc and same placement new in both cases
 
@LucDanton I just noticed that the std::forward<PolyFunc>(f) was misguided in the constructor, right? Since PolyFunc is not in deduced context there, it is basically a long way of saying std::move(f), IIRC.
In fact, I should probably add a copying constructor for non-movable functor types/non-rvalues
 
But (s)he didn't ask for behind the scenes. There is no such thing as value semantics or move semantics. Every high-level construct gets dismantled at a lower level to a series of memory jumps, fetches by address, processing in the registers, shuffling around stackframes etc. There's isn't even memory allocation or freeing at the lowest level. Once you jumpstart your bootloader at 07c0:0000, the entire memory is your playground. Before an OS and memory security, you just take any piece of memory
you can address (as of UEFI, you don't have to fuck around from real to protected to long). But going into this is stupid. We're talking about C++ ideas.
 
@Abyx I wasn't trying to make you wrong in your answer for the comment you left on my answer.
 
But in C++, all of those ideas exist. Very much so. And we discuss them.
 
11:35 AM
@jalf except for the fact you've now got a confused person ;)
 
@TonyTheLion Which is not wrong
 
that's subjective
 
@sehe Nope.
 
Xeo
@sehe It's a deduced context in make_visitor
And is passed along
So you either have an lvalue reference or a value type in the VisitorWrap
 
@Xeo Yes. But the parameter to the constructor is non-deduced PolyFunc&&, right? I'm not saying the forwarding was broken, I was merely thinking it was 'bad style' to use std::forward<> where std::move would be more accurate in expressing intent?
 
Xeo
11:40 AM
@sehe It would not
If PolyFunc is an lvalue ref, std::move is wrong
 
@sehe Observe.
 
Xeo
And PolyFunc&& with PolyFunc = T& is T& && is T&
 
Ahhhhhhh. I get it - PolyFunc itself might be an rvalue-ref (as in, the member might be too)?
 
Xeo
It's extended perfect forwarding, or what I refer to as "perfect storing".
 
@sehe Nope.
 
Xeo
11:41 AM
@sehe Not rvalue ref
 
I'mma cry
 
Xeo
@LucDanton I was really concerned about that "nope" just now.
 
Coliru is getting quite a bit of traction lately.
 
Learn it bite-sized. Start understanding the perfect-forwarding factory first. The return type appears important but it's not -- the deduction rule of function templates is the only magic here.
 
11:43 AM
lol at edit
 
Xeo
lol'd
 
Waking up is rough :v
 
Need To Pee: Most Annoying 3
 
@Xeo I think I get that now. (Why is rvalue-ref not an option/issue?)
 
If you deduce T&&, then T is never an rvalue ref. It would need the && bit.
 
11:45 AM
@LucDanton Ok
 
@sehe Storing a reference to an expiring object is plain stupid.
 
@R.MartinhoFernandes what if you are writing a graveyard object?
 
That does mean that something which has a like signature T&& foo(T&&); is 'suspect', in a sense.
 
@R.MartinhoFernandes (Ah. I'm falling to the && is sometimes universal, sometimes rvalue-ref trap just now)
@bamboon That's plain stupid
 
@sehe it was a joke
 
11:47 AM
@LucDanton A big sense, I sense. I mean, rvalues are best returned by value; notable exception: static_cast<>/std::forward<>
@bamboon Well duh. My answer was too :|
 
@sehe Yup.
 
@LucDanton Wokay. Am I correct in thinking that the make_visitor function template will never return a wrapper with PolyFunc as lvalue-ref, though?
 
Xeo
@sehe If you pass it an lvalue...
Then it will store an lvalue reference
 
@Xeo I'm not talking about the type of the member variable here. I'm talking about the 'identity' of the template argument (ie. nothing is being stored)
 
@sehe Not sure what you mean.
 
Xeo
11:50 AM
@sehe uuh... PolyFunc can be T&, if you mean that?
 
(Removing the constructor out of the equation and considering something as /* templ */ struct store { T value; }; might help.)
 
@Xeo Almost. Technically, it could, but my understanding is that make_visitor will never return such a wrapper, because of how it deduces it's argument type?
 
It can, hence my example above.
 
@LucDanton Mmm. Giving it another long hard stare
 
Xeo
make_visitor(an_lvalue) will return VisitorWrap<Ret, T&>
 
11:52 AM
@sehe I could make a something non-movable I suppose.
 
@LucDanton Eureka. I must learn to think of && as potential lvaluerefs (or universal refs) more generally... coliru.stacked-crooked.com/…
 
Now, how do you want to write your constructor?
 
> Now let consider a simple task check whether the first and the last characters ina string are equal.
WTF do people do with strings.
What's the fucking use of such a "simple task"?
 
@LucDanton With std::forward<> :) Good thing I already had that in my own version as well - but now at least I understand it "better again"
 
11:57 AM
What do you take as an argument?
 
Xeo
@sehe And what is decltype(s)::value_type here now? :)
 
@Xeo decltype(a)
 
Xeo
Ya
 
user1357851
Is your move constructor portable across different platforms? I.E. can I use it on RPC
 
@LucDanton The PolyFunc&& (which might be reference collapsed as an effective PolyFunc&, even though it's not in deduced context at the member declaration)
 
11:59 AM
Yep.
 
Xeo
I think sehe passes.
 
I'mma stop crying now :)
 

« first day (915 days earlier)      last day (4048 days later) »