« first day (577 days earlier)      last day (4362 days later) » 

3:00 PM
Do you think VS adds complication? I'm a C# developer starting out in C++, and i open VS by habit. Sure there are some compiler settings, but doesnt every IDE have those?
 
@Neil Isn't there a new version of that somewhere? That one is like 50 years old
 
@Collin Nope, pretty much discontinued & dead
d-e-d
 
@KonradRudolph Someone linked at one point to something that was essentially a fork of devcpp
Oh, there's no mac version either, yeah use Xcode
@KonradRudolph Here it is: orwellengine.blogspot.com
 
@Collin Nice!
(I still think using a crappy IDE is the wrong approach)
Either use a full-blown IDE like Visual Studio or learn the Unix toolchain
i.e. Vim & makefiles
 
user1157393
aweome. thanks for the help
 
user1157393
3:07 PM
yeh xcode is free
 
user1157393
can i use that?
 
@ChrisTill I haven't used it in a long time, but it should be fine
 
Xcode works well.
 
user1157393
@Collin great.
 
@Neil No. No no no. Or, at least, not that version.
 
3:14 PM
xcode+cmake+svn was a terrible combination last time a colleague tried it since any changes to the project itself seemed to result in a denial of service against the IDE whilst it rescanned everything.
 
user1157393
what is cmake?
 
Xeo
@thecoshman: New UHC season!
 
Ah, roadblock
std::function doesn’t implement operator == for non-nullptr …
 
user1151738
hello
 
user1157393
hello
 
Xeo
3:18 PM
@KonradRudolph How could it?
 
@Xeo Good question, but I need it
 
Xeo
Why?
 
user1151738
stackoverflow.com/questions/10598926/… Could someone take a look at it ?
 
@Xeo To remove an observer from a multicast delegate
@cadhityaa Like, totally wrong chat.
 
user1151738
why ?
 
3:19 PM
@cadhityaa looks more like a superuser.com question to me and nothing to do with
 
user1151738
hmmm
 
Xeo
Then wrap the std::function in a struct with something that uniquely identifies the observers
 
my f1 key joke lives on with 13 stars, wow
 
@cadhityaa take a look at some of: superuser.com/search?q=easyphp before flagging to migrate though.
 
@stdOrgnlDave F1 doesn’t do anything on OS X anyway
 
user1151738
3:21 PM
sure
 
I dreamed about that damn worst-case raytracing equation last night
 
@KonradRudolph operator+= could return a token which could be used to remove function
 
hey, is a =+ 4; valid syntax?
 
@Abyx I like that solution … I’m still thinking about an intrinsic way to identify targets though
I mean, identifying function pointers for instance shouldn’t be difficult
as for functors, those can be identified by type identity
(requires RAII but well …)
 
@stdOrgnlDave yes it is, it assigns left side to +4.
 
3:23 PM
as for lambdas, they simply cannot be removed
 
@KonradRudolph functors can have same type but different data
 
Xeo
That's why I said you need a wrapper
 
@Abyx Yes but I’d argue that in all real use-cases this would be irrelevant in my case
@Xeo Yes, but that requires a syntactic overhead at the client side which I find injustifiable
 
@MooingDuck thanks
 
@Xeo You can no longer simply say,
 
3:25 PM
@Xeo and here's me thinking I could get some glskel dev done
 
event += foo();
// later …
event -= foo();
 
any way, home time for me, almost
 
… with foo being a functor
 
Xeo
@thecoshman :)
 
@MooingDuck now I can do while (a=+4) and obfuscate my code needlessly
 
3:25 PM
sod it, to the bus!!!
 
@KonradRudolph maybe foo; ?
 
@Abyx Hmm? No, foo is a type
 
ah, I see
 
@stdOrgnlDave in a while loop? That is obfuscated :/
 
but they are completely different objects %)
 
Xeo
3:27 PM
@KonradRudolph I understand the problem, however with the multitude of ways you can fill a std::function, you'll have problems identifying if one std::function is the same as another, or contains a specific function
 
@Xeo Yes, there would probably be a prohibitive overhead for the general case
 
you can't have void remove(function<void()>& f) { event -= f; } then
 
Xeo
for function pointers, it's easy, but you exclude functors with that. For functors, you could force them to inherit from a specific base that has a unique ID stored for every subclass
 
because all function<void()> have same type
 
Xeo
But that's all limiting
 
3:29 PM
I like stripes in the chat
 
@MooingDuck it's like while(1), infinite loop, using break to exit
 
Xeo
Hm
 
@Abyx But my operator -= is a template, so the argument type would not be void(), it would be F, with different values for F.
 
@stdOrgnlDave I see that, and you are a bad man
 
@Xeo I still believe it’s also possible for general functors by comparing just their types. Not for the general case, granted, but good enough for my use-case
 
Xeo
3:31 PM
Well, I have an idea
let me think about it for a second
 
does anyone know if lambdas generate thunks when you do something like auto p = [&]{ x=+4; }
 
@stdOrgnlDave what kind of thunks?, it generates functor
 
@stdOrgnlDave looking up thunks...
@stdOrgnlDave judging by the wikipedia page, all lambdas are thunks.
""thunk", according to its inventor, "is the past tense of 'think' at two in the morning""
 
@MooingDuck almost looks as a Python string
 
Xeo
3:36 PM
@KonradRudolph: How about this: Internally, you wrap the std::function and save things like if the argument to operator+= was a function pointer and if yes, save it in a void(*)(). In operator-=. you check that. If it was a funcptr, you convert the argument to a void(*)() too and check address identity. If it was not, you get the .target_type from the std::function and compare it to the typeid of the argument (after stripping all references and cv-qualifiers)
 
@awoodland functional
 
Xeo
Atleast you make it sound like the same functor type will always be the same functionality
 
@Xeo That might work, but I’m actually concerned about lambdas now … @Abyx’ solution using identification cookies might work better
 
Just comparing types gets you a very strange definition of equality.
 
Xeo
@KonradRudolph Each lambda has a unique type, so you will get equality there
Think of lambdas as normal functors
They're nothing special in that regard
@RMartinhoFernandes Yeah, but @Konrad said that suffices for him
 
3:39 PM
for(int i = 0; i < 100; ++i) {
    foo([i] { return i; }); // are all the lambdas generated here equal?
}
 
Xeo
They'll all have a unique type atleast
 
@Xeo Yes, I know. That’s why I’m concerned
 
@RMartinhoFernandes As @Xeo said, it’s good enough for my purposes.
 
There's only one type there.
 
3:40 PM
they have a type you're not allowed to know
 
Not 100 types.
 
@RMartinhoFernandes compiler may unroll the loop
 
I'm having difficulty with the template member function here
http://ideone.com/cvqOQ
 
Xeo
@RMartinhoFernandes Could be unspecified actually, but makes sense
 
@RMartinhoFernandes Indeed, 1 != 100.
 
3:48 PM
What I'm trying to is to create a version setValue for several types
 
@Abyx I don't see how that changes anything.
The expression has only one type.
 
@RMartinhoFernandes so that becomes 100 thunk generations?
hey, I just figured out when overloading the comma operator would be useful
 
@stdOrgnlDave "comman" operator?
 
for(int i = 0; i < 100; ++i) {
    struct lambda {
        explicit lambda(int i) : i(i) {}
        int i;
        int operator()() { return i; }
    };
    foo(lambda(1));
}
 
better, less ugly named parameters
 
3:52 PM
@stdOrgnlDave Becomes something like this.
 
System.out.println("Why is the java chatroom always empty?");
 
@stdOrgnlDave oh, comma. Got it
 
@RMartinhoFernandes explicit is for constructors, is there a different use for lambdas?
 
@JohnMerlino NullPointerException was thrown.
 
@stdOrgnlDave or just use the named parameter idiom
 
3:53 PM
@MooingDuck that is ugly
 
@stdOrgnlDave that's a constructor
 
@stdOrgnlDave That's just habit. Actual lambdas don't have constructors like that.
 
oh, DUH
 
@stdOrgnlDave I think you'll find commas not much prettier.
 
3:53 PM
so that struct is indeed re-created each and every time.
 
Every message I post is posted "3m ago".
WTF.
 
@stdOrgnlDave but the type is created once. They're all the same type
 
ok, works
gist: Multicast function demo, 2012-05-15 15:54:04Z
#include <iostream>

#include "multicast.hpp"

void f(int n) {
    std::cout << "f(" << n << ")\n";
}

struct g {
    void operator ()(int n) {
        std::cout << "g::()(" << n << ")\n";
    }
};

void h(double n) {
    std::cout << "h(static_cast<double>(" << n << "))\n";
}

int main() {
    util::multifunction<void(int)> event;

    auto f_tok = event += f;
    auto g_tok = event += g();
    auto h_tok = event += h;

    event(42);

    std::cout << "\nRemoving g\n";
    event -= g_tok;
    event(23);

    std::cout << "\nRemoving h\n";
    event -= h_tok;
    event(101);

    std::cout << "\nRemoving f\n";
    event -= f_tok;
    event(97);
}
 
Ow.
My screen!
 
@KonradRudolph ¬_¬ really
 
screw that, I'll moan here
 
This is wrong!
Fuck you chat.
4
 
Xeo
F5
 
@stdOrgnlDave 100 instances are created. Of a single type.
 
3:56 PM
@RMartinhoFernandes Hmm, for me the time is correct
 
@RMartinhoFernandes so...what?
 
@Xeo No, there's no latitude to generate more than one type: §5.1.2/3 ties the type to the lambda-expression (i.e. the syntactic entity).
 
Xeo
derp, right
 
@stdOrgnlDave So depending on what you meant by "struct" (the type? the objects?) you could be right or wrong...
 
mind you, this was before C++11 enums

tmp = new log::event(log::event::params().auto_time().target(log::enums::et_main).type(kc::log::enums::et_informational).message("Logger thread shutting down and discharging remaining events"));

would become

tmp = new log::event(), auto_time, log::enums::et_main, kc::log::enums::et_informational, "Logger thread shutting down and discharging remaining events"
 
3:59 PM
How does it know the last one is a "message"?
 
const char*
 
@TomWijsman this is the only type of onebox that takes up so much screen estate. Wikipedia, Twitter messages/profiles, SO questions, etc. all seem more reasonable, and the exception for the github onebox violates the principle of least surprise. — sehe 27 secs ago
 
@RMartinhoFernandes the message is the only thing that takes a char*, I'd expect
 
or std::string
 
@stdOrgnlDave So, that scheme doesn't allow different parameters of the same type?
 
4:00 PM
@stdOrgnlDave that works as long as each parameter thing has a different type
 
@sehe Well said
 
or if types have different values, for instance with the enums, et_informational may be in a different range than et_main. but yes, it does have a type issue, which can be solved with ,message("...") when there are conflicting types
 
And now you have the same, but with a comma instead of a dot.
 
only in some cases
 
Hmm. Constructing a tuple<T...> from a tuple<U...> will be the nasties.
 
4:02 PM
@RMartinhoFernandes and no names where the types are different
 
@MooingDuck You can get easily that with variadic templates.
 
@sehe this needs to take up the whole screen as an example of how annoying it is
 
I need to map the internal mapping of one into the internal mapping of the other.
 
hey everyone remember to star "if you are new here"
@RMartinhoFernandes does not this:

for (int i = 0; i<100; i++) {
int c = 4;
foo(c);
}

"Create a new c" each loop?
 
Yes, but not a new int type.
 
4:06 PM
Has anybody of you yet tried to use GDB with C++11?
I get weird errors …
 
so we are indeed generating lambdas that only live short, hard lives
does this work?
auto p = [&] { i++; }
for (int i = 0; i < 100;;) {
p();
}
to increment the i in the for loop
 
@stdOrgnlDave sure
@stdOrgnlDave syntax error too many semicolons
@stdOrgnlDave also: no, there's no i in scope, so it can't grab it by reference
@stdOrgnlDave also: why? It's not like there's any real overhead
 
so the lesson is: if we want a lambda that uses variables declared in the scope of a loop, we will end up creating a new lambda each iteration unless we pass parameters explicitly to a lambda created outside the loop. OK :-P
 
@stdOrgnlDave so what? Again: no real overhead
 
I think the lesson should be: lambdas are not special.
 
4:11 PM
indeed. just like any type, you should declare outside a loop if you want to avoid re-constructing an object each iteration
 
@stdOrgnlDave no. it's a function like any other. It is not special.
@stdOrgnlDave once optimized, there is nothing "constructed". It's just a function call.
 
@MooingDuck no, we just established that declaring a lambda inside a loop ends up constructing a new one each iteration, i.e. 100 different functions
 
@stdOrgnlDave it creates a new function pointer each iteration. Which is constant and thus optimized out.
 
@MooingDuck No, a lambda is not a function pointer.
 
and that's only the observable behaviour
 
4:14 PM
@RMartinhoFernandes ish
 
There is only one function there: the lambda member function operator().
There is a new object that holds an int every iteration.
 
so...does that mean we get 100 functions or not?
 
@stdOrgnlDave There is one function. Lots of lambda instances.
 
Would someone kindly take a look at this bit of code: http://ideone.com/cvqOQ
Why is f1.setValue<Bar>() okay, but `f1.setValue<Bar, int>()` and `f1.setValue<Bar, Bar::TYPE>()` illegal?
 
@MooingDuck I understand what you're saying but I think I disagree, will anyone else weight in
I can't think of a trivial test case that would show either way :-\
 
4:16 PM
@stdOrgnlDave R.Martinho said the same thing just a moment ago
 
oo! static variable declared inside lambda
 
@stdOrgnlDave the lambda is a function like any other, it's merely defined inline.
 
No. An instance variable.
 
for (int i = 0; i < 10; i++) {
[&]{static int x = 0; x+=4; std::cout << i << " " << x << std::endl;
}
 
4:17 PM
void mylambda(int& i) {
 static int x = 0; x+=4; std::cout << i << " " << x << std::endl;
}

for(int i=0; i<10; i++) { mylambda(i);}
same thing
 
@MooingDuck mylambda is saved as a function pointer?
By that I mean, it goes on the heap or the stack?
 
Wrong question.
 
@Neil it's a function. The parameters go on the stack.
 
... object.
 
@RMartinhoFernandes I fail to see the difference for these cases.
 
There are captures.
 
it does create only one function
 
@RMartinhoFernandes oh right, forgot about that. The [=] thing
 
well, that's really handy to know that. it's odd it doesn't construct a new one like it would construct a new everything else, like say, a class, but cool
 
Functions are created only at compile time.
 
4:23 PM
@stdOrgnlDave it constructs a new functionoid object (which holds the [=] variables, but they're all of the same type, and so there's one instance of the function itself created.
like having a lot of std::string instances. There's still only one [] member function.
 
yeah, but if it were a class, there would be 10 class constructions
 
@stdOrgnlDave one constructor, called ten times.
 
@MooingDuck no, 10 different objects
 
@stdOrgnlDave right
 
And with the lambdas there are n different objects!
They're not special.
 
4:25 PM
it's the idea of if "a lambda = a function" or "a lambda = an object that behaves like a function", it looks like the first is the thing
 
@stdOrgnlDave a lambda is an object that has a () function
 
@RMartinhoFernandes if that were true then why would the static x declared inside the lambda not be 4 each loop?
 
@stdOrgnlDave because there's only one function
 
@stdOrgnlDave Ok, so write an example with a class where that happens to a static variable in function scope.
 
4:26 PM
34 mins ago, by R. Martinho Fernandes
for(int i = 0; i < 100; ++i) {
    struct lambda {
        explicit lambda(int i) : i(i) {}
        int i;
        int operator()() { return i; }
    };
    foo(lambda(1));
}
There is one lamba type, and one operator() function, and 10 instances of lambda objects.
 
for(int i = 0; i < 100; ++i) {
struct lambda {
explicit lambda(int i) : i(i) {}
int i;
int operator()() { static int x = 0; x +=4; std::cout << i << " " << x << std::endl; return i; }
};
lambda a(i);
}
 
Needs a a() then, otherwise the function is never called..
 
See, same behaviour.
 
never woulda believed it, I'd thought static variables in member functions were unique to each class instance
but they're not
another assumption down the toilet
 
4:34 PM
:)
So, is it all clear now?
 
Does it make sense to specialise std::swap (or overloading it) when my type does define all constructors / assignment / destructor as = default?
 
no, the question still remains: there is one lambda function, so is an object 'created' to 'contain' it each time?
 
OK. thanks now all is made clear
 
Or does std::swap use the appropriate move construction / assignment automatically? (rather than copying)
 
4:36 PM
std::swap does std::moves.
 
ok, beautiful
 
thanks @MooingDuck and @RMartinhoFernandes, I'm out for now, c'yall later
 
oh hai
what's been up here?
 
lambdas and how they really work
 
@TonyTheLion And how to bundle them up
 
4:44 PM
Interestingly, the -i switch for grep is case-sensitive
 
@KonradRudolph lol
 
@TonyTheLion Not a joke, I’ll put a mini toy project up in a few secs
 
oh, I don't think I was really following what you were saying
 
4:59 PM
@SethCarnegie sorry dude i've been afk, i saw that you said you got the effect you wanted? Im glad to hear it
@SethCarnegie and it looks like you did a good job on it
 
@johnathon I just left the messages for you to read whenever you got back yeah
@johnathon but there's still that problem of iterating child windows, is that just a fact of life or is there a better way
and there's at least 2 bitblts per child window
 
@SethCarnegie let me look at what you've got
 
@johnathon did you find the paste
 
@SethCarnegie If you invalidate a window, that window will get it's repaint called, and subsequently all child windows of that window will be invalidated as well. They will all repaint. Windows will do the iteration through the child windows for you. you just have to worry about drawing at the right times
@SethCarnegie and i see you double buffered your child.. Good work , it's smooth as silk now
 
Maybe the least-tested code I’ve ever hacked together & published
 
5:05 PM
@johnathon the only reason it works though is because I have to bitblt the parent's backbuffer into the childs, draw into it, and then bitblt it back
 
Why hello there.
 
I don't do anything in the HDC of the child
so the child has drawn into the paren'ts backbuffer, then the parent bitblts it into the paren'ts hdc
 
im looking for a decompiler that can produce pseudo code
 
IDA Pro with HexRays
 
yeah
 
5:07 PM
@SethCarnegie im looking at this. Its working though, Let me ponder on this and see if i can think of a more modular way to do it, without having to grab ahold of a global back buffer
 
but xrays is not free
 
I don't know any other unfortunately
 
ok
 
@johnathon well the global variables are not a problem, I can do it by attaching the backbuffer to the HWND of the parent and have the child get it's parent and extract the backbuffer from that (from the GWLP_USERDATA or whatever) so the modularity isn't a problem
@johnathon it's as you said, getting the drawing at the right time
without messy manual intervention via sending WM_PAINT messages to all the children
 
yup
@SethCarnegie run spy++ on it
 
5:11 PM
What for
 
@SethCarnegie just to watch it, Your not getting as many paint messages as you think you are
 
@johnathon yeah I have determined that I'm only getting one WM_PAINT per mouse move which is correct
 
@SethCarnegie yup
 
I thought there would be one for the parent window and one for each child (that is two per mouse move) but Windows is doing it right and only doing one so that's no problem
 
@SethCarnegie there is two
 
5:13 PM
@johnathon oh sorry, I mean two per child window
one for when the parent sends it, and one for when Windows sends it
but it's just one
since I guess BeginPaint validates the area and Windows doesn't send one of its own
 
@SethCarnegie ah , yes, indeed that's exactly what happens, No, see, when the parent is painting, the child is gets a NC_Paint... and when the parent gets done pating, the child gets a WM_PAINT. .. follow?
 
There seems to be far fewer people than normal here. D3?
 
@johnathon the child only gets one WM_PAINT, which is the one that the parent window sends in it's WM_PAINT, correct?
and then the BeginPaint in the child's wndproc validates the invalid region so when the parent is done, Windows says oh, no invalid region, no extra wm_paint
 
@SethCarnegie let me nix that send message out
 
@johnathon but then it won't paint during the parent's WM_PAINT no?
 
5:17 PM
I don't have time to sleep and yet I'm too sleepy to work on that thing.
Waah.
 
unrelated: I hate perforce
 
@MooingDuck ooh, it even sounds like something to inspire rage
 
If I CTRL+click several files, I have to release the control button, wait a couple seconds, and then right click, or else it will launch one instance of Visual Studio 2008 per file selected.
which takes a while
 
.... and I just did it again. I RELEASED THE CONTROL KEY, STOP DOING THAT.
 
5:19 PM
I doubt that comes from perforce
Or does it
 
Why would it launch things with Ctrl pressed, anyway?
 
@SethCarnegie it appears that you don't when your clipping children, but when you aren't then yes it seems you do have to manually tell the window to repaint.
 
Or single right click for that matter.
Just use CLI.
 
Yes, C# is great
 
@CatPlusPlus ctrl+right click opens the file for some reason
 
5:19 PM
Do use CLI
 
Clear Visual Studio associations.
 
@Soohjun no other program seems to have this problem.
 
That's more windows explorer related than perforce, isn't it ?
Well that looks weird.
 
Ctrl+RMB doesn't open files in Explorer.
 
@Soohjun if you're still talking to me, I don't have to wait 2+ seconds in Explorer. Just perforce.
 
5:21 PM
Odd.
 
VS associations on .cpp/.hpp/.anything not sln are useless and annoying.
 
@johnathon yeah, it's important that all the children draw themselves into the parent's buffer between the time that the parent has painted whatever it will paint and the time that it bitblts it's buffer into it's HDC
or else you won't have transparency
 
@KonradRudolph interesting
 
@SethCarnegie yea, which at the point in time all your using the second window for is automatic rectangle management
 
@CatPlusPlus I got sick of xml files opening in internet explorer, and VS has neat highlighting. Hadn't realized that was a bad idea yet.
unrelated: generated files ought to list the tool that generated them, and the file they were generated from both.
I always thought it would be neat if programs could register a function/event with the OS to be called under low memory conditions (to dump caches, GC, flush buffers, etc), and a command line to be called under low HD conditions (or on user command) to dump caches/tempfiles/etc.
Is there any such things?
 
5:34 PM
@MooingDuck what is D3
 
@CheersandhthAlf Diablo 3 came out last night
 
What is Diablo?
 
@CheersandhthAlf a game
 
@CheersandhthAlf I feel like you're joking with me, but I'm missing the joke
 
Oh I thought it must be some kind of HOT sausage, everybody busy tasting version 3
 
5:36 PM
food makes weird things with people
 
@CheersandhthAlf it's not exactly a small game. It had 3.5 million sales before it came out.
 
^ diablo veggie sausage
 
@MooingDuck what's it about
 
@MooingDuck ah, vapor-ware
 
@SethCarnegie you run around and kill stuff
 
5:38 PM
what type of game
 
@CheersandhthAlf no, it came out yesterday
@SethCarnegie RPG
 
sbi
@CheersandhthAlf I don't think so.
 
These fries require more mayonnaise.
 
Freedom mayonnaise!
| platforms = Microsoft Windows, Mac OS X | media = DVD, digital distribution | requirements = | input = Keyboard, mouse }} Diablo III is a dark fantasy/horror-themed action role-playing game by Blizzard Entertainment, making it the third installment in the Diablo franchise. The game, which features elements of the hack and slash and dungeon crawl genres, was released in North America, Latin America and Europe on May 15, 2012, and is scheduled to be released in Russia on June 7, 2012. Before its release, the game broke several presale records and became the m...
things i've never done:
* buying a game
or anything that costs money
Tool wasn't all that bad a band
 
@CheersandhthAlf sure, you don't need to buy it, we have the piratebay
 
5:48 PM
@CheersandhthAlf Tool rocked.
 
like Parabola. and Lateralus.
it just so happened that i'm listening to that now
 
@Abyx i think it's unethical to hack games
otoh., i have no compunction whatsoever against downloading music for free
 
@CheersandhthAlf huh?
 
@Abyx Have to log in to Diablo 3 to play, so no pirates (yet)
 
5:51 PM
i have to amend statement, few days ago i bought a cheap guitar
it's not arrived yet though, so i haven't got around to testing my 40 year old valve amp (it's just been standing patiently in the cellar, as always)
hya @sbi, should I post pic of Pamela what-was-her-name, you know before baywatch?
 
I'm not sure I get how a dynamically typed language would make the implementation of dynamic dispatch easier?
 
me neither
 

« first day (577 days earlier)      last day (4362 days later) »