« first day (675 days earlier)      last day (4291 days later) » 

5:02 PM
so how's everyone today?
 
@TonyTheLion I've broken three nightlies in a row now
 
oh
doesn't sound good
 
My question above was my first here, and I got good advice within seconds. Great :)
 
so it dawned on me that when I cycle to work every day, I can't take my crutch, which I really need.
 
@TonyTheLion duct tape
 
5:04 PM
@MooingDuck Hat-trick!
 
@MooingDuck to what?
 
@TonyTheLion the bike
 
@MooingDuck I always carry one roll of duct tape with me.
 
@MooingDuck oh
 
@AntonHolmquist it depends how char *bytes was derived. You have to have a bytewise copy for it to be legit.
 
5:05 PM
@AntonHolmquist Don't get used to it.
 
@R.MartinhoFernandes oh, interesting.
 
It can solve lots of problems (not as much as finding and shooting the right people, but it's good enough for me)
 
e.g. int i[10] = {}; char *bytes = reinterpret<char *>(i) is not legit.
 
@ecatmur Cool, thanks.
 
5:07 PM
hmmm, testing...
 
@R.MartinhoFernandes I treat answers as gifts ;)
 
@jalf what are you testing?
 
my gravatar thingy
 
what's up with it?
 
still got the snowpenguin
 
5:08 PM
ah, I don't
ah well, I think it'll sort itself out
 
huh?
oh good
 
@jalf It's a yellow identicon.
 
just changed my SO email and fiddled with gravatar settings
@R.MartinhoFernandes yeah, same here
 
@TonyTheLion Yeah -- one answer (that I thought seemed pretty obvious) and my rep on meta goes up ~25% -- which mostly proves my rep on meta was pretty low! :-)
 
@jalf Well, in chat it still shows the penguin, but I forced refresh on a tab with just the image and that's what it shows.
 
5:10 PM
I had a coworker come to me concerned for checking in code written in a very unusual and out-of-date style. I had to explain to him that I'd merely moved an old function from one cpp file to another
 
At least you know they care.
 
so, bonus question: the address of functions imported from a dll isn't in any way fixed, is it? So specializing a template on it would be a pretty awful idea, right? :)
 
@jalf dll code is relocatable isn't it?
 
playing around with the idea of a traits class for specific win32 functions
 
@FredOverflow Starboard.
 
pretty sure it's going to end in pain, suffering and misery, but I'm not 100% sure
 
Is taking a function pointer even a compile-time thingy?
@FredOverflow C++11 in 2012? Sooo outdated.
 
seems like it. At least it compiles under MSVC
 
5:17 PM
@FredOverflow Listening to it now
 
I'm downloading the large WMV version
takes foooorreeevvverrr
 
enum win32_funcs {thing1, thin2};
template<win32_funcs func> struct win32_traits;
template<> struct win32_traits<thing1> {
    void operator() {thing1();} //compile time functionoid thingy
};
 
@TonyTheLion 2.2 GB.
 
indeed
 
come to think of it, I guess it would work, in that it's all resolved at compile-time anyway. Doesn't matter what address the function ends up being loaded into
 
5:20 PM
@jalf I'm not sure about that, I don't think a dll function's address is known at compile time.
 
Hm, good point.
@MooingDuck The address of a statically linked one isn't either.
 
the address of the function is only the runtime address, no?
 
@R.MartinhoFernandes is a function pointer a compile time integer thingy? I think it is. I wonder how all that magic works? :(
 
@MooingDuck But it doesn't need to be. If I specialize win32_traits<F> for F==CreateWindow, then `win32_traits<CreateWindow> just has to find the specialization. It doesn't matter that the address isn't fixed, as long as it's a unique symbol, I guess
 
@MooingDuck It's a symbol reference.
 
5:21 PM
@sbi If I really wanted to "revenge downvote" you, I wouldn't have commented on your answer, told you why I downvoted, and told you exactly when I would remove the downvote. :P (I wasn't even looking for your answer, I just happened to run across it.) That said, it certainly was my mistake to misread it as relating to what you said in your comment, but evidently it did not, my bad. Still, would be nice if you waited a little before drawing conclusions about people's personalities...
 
@MooingDuck If it helps, you can't reinterpret_cast at compile-time.
 
@R.MartinhoFernandes Hmm, you can't? MSVC is wrong then, it let me do it a moment ago
 
No words about modules or did I miss something?
 
@R.MartinhoFernandes seems like it would be doable
 
@jalf Yes, I'm sure you can't.
I can produce citations if you want :)
 
5:23 PM
Nah, I trust you :)
 
-5
Q: MultiThreading - 5 or 100 threads?

idishI have a dual core processor, now let's say that I want to make a spam bot program, which will spam messages such as "Hey, how are you?". My question is, what would be faster, running 5 threads or 100 threads botting the messages? (Of course, these numbers aren't special, just for the example)....

really?
 
just surprised because I tested it 10 mins ago
but I guess that's just a MSVC quirk
 
MS is good at quirks
 
@R.MartinhoFernandes Well, I can't star my own messages, now can I?
 
@FredOverflow It's already there!
 
@jalf It's problematic because you can easily get a mismatch between a compile-time evaluated one and a runtime evaluated one.
 
@R.MartinhoFernandes oh :)
 
aaaand there's no "common" pointer type for all pointers either, right? Like all object pointers can be safely converted to void*
 
@R.MartinhoFernandes Why is it called memcpy instead of memcopy, anyway? Was there no space for the o back in the 70s? :)
 
we should have std::pointer
 
5:27 PM
@R.MartinhoFernandes So it is. 5.19:2.
 
@FredOverflow there was something about 6-char identifiers back in ye olde days
 
@jalf memmove?
 
@Mehrdad I'm guessing that came later
 
@FredOverflow creat.
 
@TonyTheLion template<typename T> using pointer = T*; or something. Not really familiar with template aliases. Does that work?
 
5:29 PM
I have no idea
robot?
 
@jalf union { void *; void (*)(); }
Although, pointer-to-members and pointer-to-member-functions.
 
There is no guarantee whatsoever that a void(*)() will fit into a void*.
 
@FredOverflow Right, that's why I'm using union.
 
@jalf Not if you include member pointers, fo'sho.
 
@ecatmur You also need to add pointer to member, which is different from either one -- but unfortunately X::* is different from Y::*, and while they're probably compatible (i.e., assigning one to another doesn't necessarily lose information), I'm not sure of an equivalent to void::* that's (guaranteed) compatible with a pointer to a member of any class.
 
5:36 PM
@sehe I hope you didn't read from non-volatile local variables after the longjmp ;)
@kush Oh, very nice cover!
 
@JerryCoffin the problem is virtuals - virtual inheritance for pointer-to-member, virtual functions for pointer-to-member-function.
Some sort of type erasure would be needed, so ew.
 
@thecoshman I have given up on learning any more C++, my head is completely filled :)
 
@JerryCoffin There's such a thing as void::* ?!??
 
@Mehrdad no, he's speaking about a hypothetical construct
 
and nor should there be
let's face it: member pointers suck in every way conceivable.
 
5:42 PM
@Mehrdad No -- I just meant a pointer to member type that's analogous to a void * -- i.e., a void * can hold a pointer to any object type, and what you'd need here would be something that can hold a pointer to a member of any object type.
 
@MooingDuck Ah lol
@JerryCoffin Ah I see xD thanks
 
@DeadMG I find myself madly trying to think of a use-case
 
@DeadMG Nah, Chromium uses them in callbacks
 
@Mehrdad And that prevents them from sucking how?
that really just makes Chromium suck.
very hard
 
@Mehrdad it could have (and should have) used functionoids instead.
 
5:43 PM
@DeadMG Can you be more specific?
 
sure
 
@DeadMG I have to disagree. I can conceive of ways of sucking that are really very good things -- and I'm pretty sure pointers to members don't suck in any of those ways.
 
I say: "X sucks."
you say "X can't suck, because Y uses it."
 
@MooingDuck What's a ... "functionoid"? Like, functor?
 
this is blatantly not a meaningful argument.
 
5:43 PM
@Mehrdad yeah
 
@MooingDuck How? Could you give an example?
 
@DeadMG well, I don't care about those. Just C-style functions, basically
 
it's a complete appeal to authority fallacy, where Y is the authority.
 
 class functoinoid {
     T* obj;
     functionoid(T* t) : obj(t) {}
     void operator(){obj.memberfunction();}
};
 
@jalf Then you still have the problem that you can't mix void* and void(*)(). But on virtually every machine anyone uses these days, you can.
 
5:45 PM
@Mehrdad or a lambda
 
@DeadMG No, I was saying that Chromium has good use cases for it
@DeadMG Not saying that Chromium is an authority lol
 
@Mehrdad yes you did
 
@Mehrdad They suck at callbacks. std::function is much superior.
 
@DeadMG Instead of consistently saying "sucks", can you be more specific? That's what I was asking
 
right
well, let me see
you can't bind them to lambdas for local callbacks
 
5:46 PM
@MooingDuck But then you have to make a class for every member function! The way they do it, they say bind(&Foo::bar, instance)
 
you can't bind them to free functions if you don't need state
you can't bind them to bound functions, like the result of std::bind.
you basically can't do anything with them, at all, ever, except the most restricted use case possible.
 
@DeadMG OTOH, simply saying "X sucks", without supporting facts, uses the same fallacy, simply substituting yourself as the authority.
4
 
@Mehrdad give me a sec
 
and even then, they suck hard, because the syntax is really dodgy, and they have questionable semantics when it comes to things like inheritance and whatnot
 
@Mehrdad so use a lambda. It's the same thing
 
5:47 PM
@JerryCoffin Not exactly. The difference is that I'm right here and you can ask me why it sucks. Nobody can ask Chromium why it did what it did.
 
@DeadMG Yeah, printf() and fprintf() suffer from the same problem in C, but guess how many people use printf() and find it useful
 
@Mehrdad Irrelevant. Not only do printf and fprintf suck, but the number of people who use a thing is orthogonal to whether or not it sucks.
 
@DeadMG Yes, it is exactly right. The fact that you may separately apply reasoning as well doesn't change that.
 
@MooingDuck They haven't migrated to C++11 yet. (Realize they have good reasons for not doing so.)
 
@JerryCoffin No. The whole point of the appeal to authority fallacy is that the authority can't be questioned.
that's what makes it a fallacy
else, it's just using a reference
 
5:49 PM
@ecatmur Xeo also said that. I think this is for the best. Although it sounds very const_cast-y
 
@Mehrdad No, you don't.
 
@DeadMG If you're in C, nothing about them "sucks".
 
You can make a template for them all.
 
@Mehrdad We're not, and I don't give a shit about C.
 
@DeadMG Well pardon me for not realizing your ignorance
 
5:50 PM
well, considering that we were discussing member pointers, being in C++ seemed a logical conclusion.
and more accurately, printf and fprintf still suck in C. It simply doesn't allow for anything that doesn't suck.
 
@DeadMG That's not really true either (and having made that as an unsupported claim, you're just doing the same thing again).
 
@DeadMG I like using printf for simple stuff.
 
@JerryCoffin You're not supporting your side of it either.
 
@DeadMG I was just telling you why people (e.g. Chromium) use pointers to members, and find it useful, even though it's very restrictive and seems pointless. Just like how printf() seems pointless in C because fprintf() exists, and yet lots of people find printf() useful in C. So your reasoning doesn't apply.
 
5:51 PM
god damn
is "people" all you can say or think about?
"people" kill themselves, or each other
"people" commit genocide
 
@DeadMG Until or unless you supply something that actually resembles a fact, I don't need to. You haven't said anything that needs refutation beyond the fact that it's an unsupported assertion.
 
just because "people" do it, does not mean anything.
 
Lounge<C++>, where every discussion with @DeadMG turns into a meta-discussion.
 
@DeadMG You're living with 6 (7?) billion other people in this world. It certainly does. And comparing member function pointers to genocide is a little stupid, if you ask me.
 
@Mehrdad Only if I'm doing something related to them. But writing a program certainly is not.
 
5:53 PM
@rubenvb +1
 
Lounge<C++>, where people aren't important
 
@TonyTheLion Except me. I'm important.
 
not even you :P
 
@JerryCoffin Well, as far as I can tell, the argument I made was based on logic, and logic is a fact.
 
@DeadMG Ah, I forgot, if people never read your programs then never mind.
 
5:53 PM
@DeadMG what if the logic is flawed?
 
grabs popcorn
 
@TonyTheLion DeadMG's never is, I guess
 
@Mehrdad that's what he thinks
 
@Mehrdad note that I did not take your side. He has a very valid point about your point being utterly invalid.
 
@Mehrdad Eh. I prefer to focus my efforts on people who matter.
 
5:55 PM
@DeadMG Even you admitted that what you said was simply "X sucks". If you honestly think that qualifies as "logic", then you clearly need to go back to the very beginning of elementary school and learn 1) some vocabulary, and 2) the very most basic tenets of logic.
 
@Mehrdad Actually, it proves my point just fine- namely, that "people" do not need a reason to do anything, and just because "people" do it has no bearing on whether or not it's a remotely good idea.
 
It must be hard to be a non-C++ programmer. Imagine that any time you want to do a bit of for-fun coding, you have to try to build a functional application or something. There's something incredibly relaxing about being able to to just mess around with ridiculous and impractical TMP experiments instead :)
4
 
@rubenvb What part of my point is invalid? Could you expand on it? (You haven't said why, you just said it is)
 
@JerryCoffin Huh. All this time I was thinking that we were arguing about our difference of opinion w.r.t. appeal to authority argument. Maybe we've been arguing about nothin.
 
5:56 PM
lol
 
@Mehrdad Your point basically is this:
13 mins ago, by Mehrdad
@DeadMG Nah, Chromium uses them in callbacks
 
@jalf You have never played with Monads, have you? :)
 
@rubenvb No, then you missed everything I said afterwards
 
Then you go on to say:
 
@rubenvb I think his point is that "member function pointers are not useless" actually
 
5:57 PM
7 mins ago, by Mehrdad
@DeadMG If you're in C, nothing about them "sucks".
which is ridiculous, because pointer to member functions aren't C.
 
@FredOverflow ok, so there are other languages that let you poke around with useless stuff. Dynamic languages with metaprogramming might qualify too
 
@rubenvb Your comment is the one that's ridiculous, because you didn't read my previous comments
@rubenvb and you think this is somehow related to the other one, when in fact it was talking about the printf/fprintf comparison.
 
@rubenvb You're missing a part of the conversation. By that time it was morphed into printf/fprintf.
 
@rubenvb The C comment was a comparison of printf in the C language to member function pointers in C++. That's fine.
 
but say you're stuck in Java or C#, what are you supposed to do if you just want to screw around and try to bend the language in new and impractical ways :D
 
5:58 PM
What's wrong with printf anyway, besides being unsafe and non-extensible? :)
2
 
@jalf You can't
 
@Mehrdad there was never a printf/fprintf comparison. @DeadMG said both sucked.
 
@FredOverflow Nothing.
 
o btw, jalf
 
@FredOverflow It's equivalent to fprintf(stdin,...), so it's technically redundant, but my point was that that doesn't make it "suck" (at least, no more than fprintf)
 
5:59 PM
@jalf Jon Skeet does that from time to time with C#.
 
dled the clang sources today and I'mma hacking on it to see if I can make it work
 
@R.MartinhoFernandes not really, printf came up after @DeadMG summed up why pointer to memebers suck.
 
now, if MSVC would just add support for variadic templates, I think this could actually theoretically turn into something usable
 
Building crazy LINQ providers qualifies I think.
@rubenvb I won't argue with you about the order of messages on the transcript. Read it.
 
@rubenvb fprintf was 100% related to the pointers to members convo. If you missed it please go back and read it instead of ridiculing my argument by pointing at unrelated comments.
 

« first day (675 days earlier)      last day (4291 days later) »