« first day (469 days earlier)      last day (4481 days later) » 

12:00 AM
 
12:18 AM
is there a way to make std::istream_iterator<int> skip over commas or do I have to parse the file myself?
 
12:29 AM
you can give std::getline a separator parameter
but apart from tha
 
some people have a real knack for pissing me off
 
wow, who?
 
a close family member of mine
 
I also found that
 
he owes me money, because of a mistake he made, and now he is putting up conditions for me to meet before he repays his debt
what the fuck?
 
12:34 AM
that's terrible
how much?
 
over 1000 Euro
 
1320.70 USD
 
thank you for the conversion :P
 
@TonyTheLion I can't be the only stupid American in the room
 
12:36 AM
man, that's really, really bad
 
THough if I recall past discussions, you DMG, and Etienne are EU somewhere
 
I mean, if it was like, a single euro, then I'd be like, "Well, that might be funny"
but over a thousand?
 
lol, yea I wouldn't really care about a few Euro's
 
what mistake did he make?
 
well, he tried to sell my car, to someone he knows, then the buyers say they can't pay the full price, so he agrees that they will pay in parts, he "forgets" to make a contract on paper, he gets 50 euros from them, hands them the car, they manage to wreck the care before they've made the 200 Euro payment mark, and then don't pay any further. Can't do nothing, as there's nothing on paper. Now the person selling this car, should pay me the difference, the original buyers didn't pay.
this event is two years old
 
12:40 AM
@TonyTheLion how'd he get his hands on the car? You "forget" to make a contract on paper?
@TonyTheLion on the other hand, I know a guy who was on the other end of that, and we were never able to convince him he should pay the rest of what he owed :/
 
@MooingDuck as I said, this person is close family, I made the mistake of trusting him to do sell the car.
 
@TonyTheLion doncha just hate close family?
 
Supposedly, one should be able to trust one's family
seems, like this is not the case
:(
 
@TonyTheLion how'd you get to be this old and still trust your family?
 
@MooingDuck now, remembering, he also said to me several times at the time, he'd make a contract, as I insisted
@MooingDuck well, I've learned my lesson since, but seems I was ignorant back then
 
12:44 AM
@TonyTheLion could sue him but the rest of the family might.... disaprove...
 
no, I've got a far better idea
I will make the facts public, for all his familiy and friends to see
if he doesn't cough up
@MooingDuck in Europe, you can't just sue anyone and everything for whatever reason. Just so you know :P
 
well, IMO, it seems silly
if the buyer can't afford the full price, they should get a loan from a bank
 
yea
or they shouldn't buy it in the first place
 
yeah
in the UK there are "verbal contracts" in contract law
and if you gave them your car, that's a pretty good argument for saying you had one
I'd check again to see if you can't sue the buyer
 
oh, like that
 
12:49 AM
after all
I doubt that any judge will decide that you gave them a functioning car for fifty euros
 
but in any case
since your family member's failure to write a contract cost you the money, then it's his damn fault and he needs to pay up
pissing around with conditions is not OK
 
I agree
 
1:04 AM
pl
ppl
anyone here
How to store a values from one dynamic array greater than some number in another dynamic array?
 
std::copy_if(source.begin(), source.end(), dest, [&val](T const& t) { return t > val; });
copy(source | adaptors::filtered([&val](T const& t) { return t > val; }), dest); using Boost.Range
 
1:19 AM
Thanks, @LucDanton
 
Oh Christ, I broke the bootloader.
 
push_back(target, my_map | map_values | filtered(is_even()) | reversed);
^ Boost.Range seems quite nice. Yet a little over the top as usual. Looks a lot like Ruby code here.
 
@TonyTheLion Definitely possible - I've answered it :)
 
1:34 AM
So... at work we our application consists of a client binary and server binary which communicate of a RPC protocol. The current implementation is kind of crappy and I was told to think of a better way to do this. One new requirement is that the client must be able to send composed commands and have the server execute them concurrently. I'm now working on a prototype where hope to achieve composability by using a combination of boost serialization and tuple libraries. Does this make sense to you?
 
I'd be tempted to go with protobuf next time someone asks me to do something like that
 
@StackedCrooked Why tuple, not a container?
 
Protobuf is an option. It's actually how the current implementation works (but crappily).
@Potatoswatter The requests and responses need to be serialized. If I can provide serialization functionality for the core objects then I get serialization for free on any combination of those objects as a tuple object. (This would actually also work on containers, like vector<T>, but then you can only have one type.)
@awoodland Which aspects of protobuf are attracting you to it?
 
@StackedCrooked Dispatch through a virtual function if command groups can vary at runtime. tuple requires them to be determined at compile time.
 
@Potatoswatter Good point. The combinations may not be known at compile time.
 
1:57 AM
where I am wrong?
 
@DzekTrek Please modify so that it should compile. Right now what's wrong is you started a comment with ***. Ah, most of that appears to be just pseudocode.
 
the copy_if statement is what bothers me
perhaps, it's not even set up right, as someone should observe?
 
@DzekTrek It contains a for loop as a function argument. for is a statement, not an expression, so it can't go there. There are numerous syntax errors on that line and it's impossible to detect the intent.
 
well yes, since it already compares the values
so for loop is off
I mean value array as is compared to x, in which he stores all values greater than x to an array b
so, it's off for sure
anything other you have noticed?
 
I'd only do that if I wanted to work with OpenGL
instead I'd rather it exploded
 
2:11 AM
@DeadMG you naughty dog! ;)
 
what?
if I want to chat about OpenGL then I will search for an OGL chat
until then, I have no intention of it
 
join and see :)
 
no
 
The puppy says no. Reminds me of...
 
more specifically, the puppy says "Stop spamming my damn chatroom"
 
2:12 AM
aw, aw, arghhhhh :)
ok, solve the Q. I gave to you here. but don't do it instantly, one at the time. It's for us to better understand it.
 
if I had any intention of doing so, I would have already
 
@DeadMG , I see.
 
the comments others have written on the sample you linked suggest that it would not be worth my time to even learn what it is you want help with
 
@DzekTrek The code you posted is utter nonsense. There is nothing to solve.
 
@Potatoswatter , correct it's utter nonsense, however it can be solved in many ways.
 
2:17 AM
@DzekTrek Yes, now get on with it!
 
@DeadMG I see.
 
@DzekTrek If the problem is that the code is nonsense, the solution is to ignore it and do something else ;v) .
 
if you wish for my help, first you must have an understandable problem
 
@DeadMG I see. @Potatoswatter Challenge accepted.
 
user406009
I have a stupid question. What happens when you send a std::function to another process and try to call it?
 
user406009
2:28 AM
In the seperate process.
 
user406009
I know they are safe to pass around between threads.
 
@EthanSteinberg How are you sending it? Shared memory?
 
user406009
Yeah.
 
Not a stupid question, though perhaps a shaky implementation strategy.
 
user406009
It was just a though experiment. I would never pass std::functions between processes as an actual design.
 
2:31 AM
Since the function is going to have a vtable pointer into the executable binary image, you would have to share that as well. Most OSes won't allow that.
Fundamentally, you would have to ensure that the two binaries are mapped to exclusive address ranges in their respective spaces, and load the callee into the caller as if it were a shared library.
 
user406009
So basically too much effort. std::function breaks down at the process level then.
 
user406009
I wonder if it would work for fork()ed processes.
 
Yeah, fork should be OK, because the state of the program is copied. There are a lot of restrictions about when you can fork, though.
 
user457812
2:52 AM
I wonder if people who start out in Java might be able to sue Oracle for mental trauma or something...
 
@nil no, brainwashing is also built in so they won't ever do it
 
user457812
I see, the clever dogs thought of this ahead of time.
 
user457812
At any rate, I want to beat the people who ask for things to be explained in ways that relate them to java.
 
Is Java the worst thing Oracle has ever done? The buyout just upped the enterprise-bullshit, lockin-strategy ante.
 
user457812
It's really unreasonable, painful, and can only result in lazy learning, if you can even call it learning to just think of everything as a java subset (which must be part of the brainwashing).
 
user406009
2:55 AM
I really hate it when you see the Java programmers using new in *every*single location.
 
@EthanSteinberg They can't help it
I wish you didn't have to use Java to write android apps
 
user457812
Even using it for an int?
 
user406009
"Hmm, std::vector?" "Too complicated"
 
user406009
Well not primitives.
 
Oh, you mean when java programmers program in C++?
 
user457812
2:56 AM
I bet some use them for primitives.
 
user406009
But arrays, objects, etc, everything is with new and delete and pointers everywhere.
 
new and delete and delete
 
user457812
Always gotta delete twice to make sure your memory is good and free
 
You're right, I've been doing it wrong
 
user406009
Well a good number of the Java programmers don't even delete once.
 
user406009
2:57 AM
Deleting twice would be an improvement.
 
Which is exactly equivalent to copying std::vector to a C-style array to improve performance.
Heh I recently started a Java job. I inherited some numeric Java code from an old-timer with C background. He tried to "make it faster" by copying the ArrayLists into native arrays.
So it definitely goes both ways.
Heh I recently started a Java job. I inherited some numeric Java code from an old-timer with C background. He tried to "make it faster" by copying the ArrayLists into native arrays.
 
user457812
Must. Have. Performance. malloc ho!
 
So it definitely goes both ways.
 
user457812
I'm kind of glad, sometimes, that I'm far too shitty a programmer to get hired.
 
Literally the only reason I don't write android apps is because you have to use Java
 
user406009
3:01 AM
Just write the crux of your application in C++ then.
 
user406009
NDK and all that. I remember writing a tetris app like that for the heck of it.
 
Isn't it really complicated
 
user406009
Yeah it was stupid. And that was just a stupid "hello world" tetris app.
 
user406009
The stupidness is probably O(n^n) with the size of the application too.
 
Yeah I would imagine
I realised today that you can be logged into a SO account from multiple computers at once
We should make a single account and have a bunch of people use it
so we can compete with Jon Skeet
 
user457812
3:25 AM
@SethCarnegie That is one of the reasons I stopped working on Android apps.
 
user457812
Although I then took up Objective-C, so I guess it depends on which poison you prefer.
 
user406009
C++ > Python > Java == C# > Objective-C > Javascript > PHP
 
user406009
Oh, and I assume visual basic is very far down on that list. Somewhere past the end of the universe.
 
user406009
Java isn't that bad when it comes down to it. At least we aren't forced to use PHP on the android. Now that would be cruel and unusual punishment.
 
user457812
3:57 AM
Considering Objective-C is completely compatible with C++, I'd have put it above Java and C#.
 
4:10 AM
Hmmmm
I am new here
 
user457812
Ok then. Welcome?
 
thanks
I am mostly a programmer of basic, but I just thought I might like to learn, or relearn rather C++
because I want to try to rewrite my Random number generator in C++
 
user406009
Why not just some of the very nice available ones?
 
user406009
I think the Twister thing is supposed to be very good.
 
user457812
Why not just return 4?
 
4:15 AM
can I get a refresher on how you create and access arrays in C++ and variables as well? because My random number generator is potentially better
 
user406009
Books are highly suggested.
 
user406009
 
Return 4? haha My random Number generator Blows the mersene twister out of the waters
yes thanks
 
user406009
The first two are the teaching books.
 
user406009
Most of the rest are just "best practice" books.
 
4:16 AM
okies
 
user457812
If you're going to claim your RNG blows others out of the water, I suggest you have something to back up those enormous testicles at which cannons are now likely aiming.
 
user457812
Unless you've got yours hooked up to a sensor on an event horizon or something.
 
user406009
I bet his random number generator consists of monkeys in a cage rolling dice.
 
LOL okay whatever you say
I did extensive tests on it using diehard and whatever I could find around
 
user457812
That's totally not random at all - anyone could simulate his monkeys in a cage rolling dice.
 
4:23 AM
I have been working on it since the 80's
 
user406009
Just joking around. Best of luck with your random numbers. See you guys later.
 
what's not totally random at all?
hey I am sorry okay
 
user457812
Do you have any papers on your RNG?
 
maybe you should see my random number generator in action before you shoot it down like that
papers, what do you mean by papers?
I have seen the mersene twister in operation , and many others, I was not impressed with the performance
 
user457812
Do you have anything published on your RNG?
 
user457812
4:26 AM
If it's as good as you claim it is, people would surely like to know.
 
nope I don't believe in such stuff
It uses an entirely untried system a new form of math
 
user457812
In that case, you're going to have a very hard time not sounding like the crazy folks who claim to have invented perpetual motion machines.
 
I am a great at math an, though I can understand other mathematicians very well I developed a unique form of mathmatics in complete isolation from the world
 
user457812
If you had something to back it up other than your word, like a peer-reviewed article in a journal or something, then you'd be able to say "well these people reviewed my such and suchery," but you don't, so I hope you're aware that your claims are probably going to sound very fishy to anyone who hears them.
 
Lets just say I have somethiing that is so new it will revolutionize the way we generate random numbers
I do have something to back me up with, my program
 
user457812
4:31 AM
You could say that, but I could also say my penis is the size of Pluto.
 
it is written in Qbasic but so what?
Maybe it is
 
user457812
The problem is that your program can have flaws and it doesn't really prove anything.
 
I would not be surprized
 
user457812
I would be pretty surprised if my penis were the size of Pluto...
 
well anything can have flaws
so there
 
user457812
4:32 AM
So what's to say your results aren't flawed?
 
user457812
If you really want to make the claim that you've got something awesome on your hands, take it to a journal
 
why don't you try it out, and see how truly random it is
Maybe I will
 
user457812
Because I don't consider myself an authority on measuring randomness.
 
but I am tired now
good night
 
user457812
And if you do, I think that would be excellent.
 
4:33 AM
Nice talking to you
 
user457812
Taking it to a journal that is - if you do have something good, then it benefits everyone to learn about it.
 
Anyone with sqlite experience?
 
I would Love to teach others how it works.. but that might take a deal of time...
well goodnight
I can learn C tomorrow I guess
 
:D hi to all)
 
Als
5:07 AM
Hey
 
> Learn to build hate systems.
???
 
Als
@R. Martinho Fernandes: Was I Summoned?
 
user457812
Systems of hate generate a pretty good amount of energy.
 
@nil but they take eternity to compile.
 
user457812
Nah, all you need to compile one is to start an internet argument on religion
 
user457812
5:12 AM
Preferably via youtube comments
 
lol....
I've seen a lot of those.
 
Als
hmm
 
Youtube comments also have a fine tradition of using refined language. I improve my vocabulary by reading them.
3
 
5:29 AM
:D
 
 
5 hours later…
10:56 AM
> You've earned the "algorithm" badge.
 
@FredOverflow That is really hard earning :)
 
Hey, guys... is anyone still awake?
 
I guess I am very alive and awake :)
 
Well, I should hope you are alive, even if you are not awake ;)
I have a question about move constructor/assignment operator, specifically compiler ability to optimize for trivial classes in their presense.
Anyone cares to spare a minute if you dealt with such things?
 
After reading your Q, I'm dead again :)
 
11:10 AM
lol
Good one... I guess, I should start a thread... but I so don't want to copy/paste assembler for people to go through, hoped someone would just answer... oh well
well, g'night, Anubis ;)
 
@AzzA gu'night :)
 
@AzzA shoot
 
Hey, Fred
 
I understand you have a question about move semantics?
 
hoped you might come back... the question is following: we have a very simple class - just one int public member and constructor to assign to it
 
11:22 AM
@FredOverflow This guy is right or me ? : stackoverflow.com/a/9044779/733152
he is guessing temp is pointer
 
@AzzA Then move semantics won't gain you anything.
 
Fred... I thought so too
5 times perfromace gain
 
A class without "external resources" cannot be moved faster than copied.
 
look, let me copy/paste a few lines
 
@MrAnubis As the OP is using temp->value in his code that is not a weird assumption.
 
11:23 AM
1 sec
 
@MrAnubis pointer.member is illegal syntax, so you're right.
@KillianDS Oh wait, he mixes both syntaxes. That is really confusing.
 
struct B { int m; int m1; B( int f ) : m( f ), m1( f ){} };
 
A move constructor cannot possibly be faster than a copy constructor in this case.
 
2 int... we have a function: B barB( int i ){ return ( B( i ) ); }
 
@KillianDS see this also temp.next->value;
 
11:26 AM
and we use it B b; b = barB( 5 );
 
@AzzA Any sane compiler will optimize the constructor call away, so it should not even matter if you have a move constructor or not, because it won't be used.
You did profile with optimizations, right?
 
@MrAnubis Yes I know, I don't say either assumption is the correct one. But it is not "wrong" of him to assume the OP made an error and that temp is a pointer, given that assumption (which he clearly states he makes) everything he says is correct
 
if I introduce stupid move operator= (trivial) i get different assembler
 
Did you compile with or without optimizations?
 
it puts things on register instead of stack
MSVC2010 full speed optimization
just one instruction different
but it's register, since it does not need to keep the copy
 
11:29 AM
@KillianDS I'm going to sue that guy :D
 
@AzzA Are the differences in the caller or the callee?
 
it's all inlined
 
So it's in the caller. Can you post the client code?
 
this is the code, all of it, just one function call
it substitutes mov dword ptr [rsp+0CCh],1 for mov ebx,1
in the presence of defined move operator=
and register is faster
if struct has just one int - it's all the same... 2 ints break it... i mean, i know you are right
it should not matter , compiler should do best job without me defining anything
for( auto i = lMin; i < lMax; i++ ) { lB = barB( 1 ); }
that's really the client code... i did some timing.. but I set lMax to 1...
it must be VC++... but it's just upsetting, if I can get such performance boost by doing something that i'm not supposed to... and there is no guarantee what compiler will do if I make struct with, say, 4 ints (although, returning like this by value, is for small things, really)
 
Did you get that performance boost in a real scenario or in a contrived micro benchmark?
Did you do a second benchmark with a different compiler?
 
11:39 AM
It was a benchmarking... I was doing wrappers around library function to translate error codes in exceptions. And I was testing between different optimizations on passing arguments.
that's the problem, I don't have second compiler :S... it's stable though. I have the same function called as part of inlined called to my wrapper
there I get real boost
instead of
mov qword ptr [rsp+60h],rbx
cmp rbx,1
jae Prototype_Console!main+0x3c2 (00000001`3fcde3c2)
c78424d800000003000000 mov dword ptr [rsp+0D8h],3
c78424dc00000003000000 mov dword ptr [rsp+0DCh],3
4183fe03 cmp r14d,3
750a jne Prototype_Console!main+0x3ad (00000001`3fcde3ad)
488b8424d8000000 mov rax,qword ptr [rsp+0D8h]
48898424c0000000 mov qword ptr [rsp+0C0h],rax
 
If you post a full, compilable example, I can test on GNU compiler.
 
i get
4883ff01 cmp rdi,1
7333 jae Prototype_Console!main+0x3df (00000001`3f9292af)
c744244003000000 mov dword ptr [rsp+40h],3
4183fe03 cmp r14d,3
750a jne Prototype_Console!main+0x3c4 (00000001`3f929294)
bb03000000 mov ebx,3
899c24c0000000 mov dword ptr [rsp+0C0h],ebx
4489742440 mov dword ptr [rsp+40h],r14d
never mind cmp rdi,1 - this is for loop
Yes, Fred, I'll make a small compilable example
and will post it tomorrow then
anyway, I'm off to bed... goodnight Fred... night, fellas
 
12:45 PM
@FredOverflow concerning your question about name identifiers, I can recommend you to read effective c++ tip 33(third edition)
 
1:23 PM
Any human being here? :)
 
1:40 PM
not until I've had another coffee :)
 
2:14 PM
Stupid MSVC doesn't support __func__.
 
Is there a boost type-trait to check if two types are equal?
 
Xeo
I think they have __FUNCTION__ though
@StackedCrooked is_same... ?
 
Yeah.
 
Xeo
#define __func__ __FUNCTION__
:>
 
Yeah. But still.
More things to check.
 
2:18 PM
@Xeo Thanks. I looked for it embarrassingly long.
 
2:30 PM
1
Q: Alternative to exceptions for methods that return objects

CubeI have a class that can perform many types of transformations to a given object. All data is supplied by the users (via hand crafted command files) but for the most part there is no way to tell if the file commands are valid until we start transforming it (if we checked everything first we'd end...

^ I answered a nother question, yay! :-)
 
Xeo
No, you comment them. :P
 
well, same thing
room topic changed to Lounge<C++>: Let the compiler do the work. [c++] [c++11] [c++-faq]
 
3
A: How to prevent an r-value

Seth CarnegieBesides @Xeo's answer, you can also do template<typename T = int> // thanks to Xeo for suggesting the default parameter void SetItem(Key&& key, const Value& value) { static_assert(sizeof(T) == 0, "SetItem cannot be used with temporary values as keys"); } This has the adva...

see comments
 
@AlfPSteinbach no, I answered another question :P
Can I get some comment upvotes on an "inline on templated is stupid" here? stackoverflow.com/q/9045767/256138
 
2:42 PM
@rubenvb i haven't looked, but in principle it's a good idea to put inline on function templates, so that one does not forget to add it for a complete specialization. the in-practice that argues against, is the g++ compiler's silly habit of treating inline as sort of compulsive. so, it's IMHO a mixed engineering/people stuff decision, i.e. one of the hard ones with not even a generally useful good answer.
 
@rubenvb I see it as useless but not harmful either.
 
hm, i should have explained what "does not forget to add it" means.
it's the fact that a complete specialization is no longer a template, so that the "normal" One Definition Rule kicks into action, so that now suddenly inline is required, which surprises even some seasoned programmers. can be a good idea to avoid that, through habit. i think.
 
ah, ok. Didn't know about that caveat.
 
3:31 PM
how to make MSVC immediately break to debugger on failed assert, instead of showing abort-retry-cancel dialog? (without changing a code)
 

« first day (469 days earlier)      last day (4481 days later) »