« first day (737 days earlier)      last day (4202 days later) » 

2:00 PM
yeah
 
+ you don't know how to do an xor swap...
 
amazing how much I hated the lack of std::swap when in Java
 
@LuchianGrigore I don’t know how to do XOR swap because I never use XOR swap, not the other way around.
 
@daknøk the two are not mutually exclusive
 
2:00 PM
my std::mutex is throwing, "device or resource busy"...how did I manage that :S
 
it's probably slower than a plain swap on modern processor
 
@melak47 lol how appropriate.
@DeadMG and if it’s not slower, std::swap is implemented using XOR swap.
 
-1
A: Qt sscanf equivalent

unwindWhy not just call sscanf() on mystring.data()?

 
So use std::swap in any case.
 
@LuchianGrigore Already been there, downvoted that, left negative comment
 
2:02 PM
Man, you guys are harsh today
 
@LuchianGrigore tough, down votes!
 
@LuchianGrigore soooo that's why downvoting costs rep
 
I downvote whether I lose rep or not.
 
@Collin It's not harsh if the question is "Is there a Qt alternative to sscanf" and the answer is "Why not just call sscanf()".
 
Downvotes are always worth the rep.
 
2:04 PM
lol
 
lol, he removed answer
 
I have two threads, an UI thread and a worker thread. they share a std::mutex mx. The worker thread locks mx when it writes a progress update to the UI, and the UI locks mx when it does a redraw to prevent the worker from updating in the middle of a redraw
 
There is a very easy solution to the problem: First downvote and then delete the question altogether ;)
 
@melak47 Normal people atomically swap a buffer.
 
@DeadMG depends how much data he is drawing to screen.
 
2:06 PM
@melak47 Yeah, double-buffer that
 
¬_¬ time to bin a load of shitty memes
 
oh no no, I'm not locking the framebuffer or anything. the worker thread is just writing two ints to the UI thread (for animating a progress bar :p)
 
@daknøk s/is/it/
 
@melak47 Or post a message, like a sane person.
 
oh
 
2:07 PM
lol
 
@DeadMG I...don't really know how to send a message from a std::thread to a QtApplication thread :S
 
@melak47 where's the question?
 
:<
 
@thecoshman the question is...is that approach generally ok? I can't figure out why my mutex throws.
 
2:09 PM
@DeadMG ಠ_ಠ
 
ah
what? You bin our memes and leave your own
scumbag DeadMG
 
lol
 
Asshole.
 
RIGHT
Not a single fuck given
 
Was Alf a room owner?
 
2:10 PM
was
damn
just realized I'm not wearing any underwear
 
room topic changed to Lounge<C++>: We're laughing at PHP. (We're not. We're actually just calling eachother names. It's Monday, after all) [c++] [c++11] [c++-faq]
 
@DeadMG tmi
 
@DeadMG Only in rare conditions could this actually become a problem
 
@DeadMG how.. what?
 
2:11 PM
You sure you wanna know the "how" of it?
 
@LuchianGrigore I'm wondering how "Asshole" made you think of "Alf" and "room owner"
 
@TonyTheLion Scumbag DeadMG!
5
 
@daknøk he needs the scumbag hat
 
@TonyTheLion TME
 
@sehe I actually went to the bin and saw his name in italics
but maybe he's a bin owner
 
2:12 PM
 
@daknøk Too cute for that meme
 
@LuchianGrigore I own several bins
@Collin Wut. Puppies aren't cute. They don't wear any underwear and poop in public
 
@sehe But just look at his wittle face and sad puppy dog eyes
 
ergh... ie
 
@Collin Tried. Not working
 
2:14 PM
Nothing is cute.
 
TIL @sehe and @daknøk are emotionless shells of human beings
 
@Collin LOOK AT MY AVATAR
 
@daknøk so beta
 
@TonyTheLion crappy function name + Java = no.
 
2:15 PM
@TonyTheLion Sure, it's an option
 
Hmm we eat carrots today. :3
 
> If you are worried about speed, then you should write
dafuq?
 
SPEED
 
@TonyTheLion You can have very heavy debug routines, even if the example sucks
 
in Java, speed is not something you worry about, it's slow no matter what
2
 
2:16 PM
It's Java, remember.
 
^ They mean that kind of speed.
 
Ah dutchies and their drugs
 
2:17 PM
@DeadCicada French people come all the way to Roosendaal every day for drugs. Stop complaining.
 
@TonyTheLion It's not that slow
 
@Collin shush
 
@TonyTheLion In a language without macros, it makes sense. In C++, you can hide that behind a macro, but without that? You either have to incur the cost at all times, or you have to write crappy workarounds like that. And the logging API should at least support that kind of workarounds. Then you can use them if you deem it worthwhile
 
@daknøk s/French people/retarded drug users/
 
@jalf lol
 
2:18 PM
Java programs are slow even with a hardware JVM.
@DeadCicada In that case, s/dutchies/retarded drug users/
 
Synonym
 
And yes, that is one of the very few cases where macros are actually useful. :)
 
java retards are now j/tards
 
/b/tards!
 
@jalf constant expressions could make the compiler ditch that kind of code at compilation time in C++
 
2:19 PM
@jalf I prefer log.debug([&] { return ...; });
 
const bool debug = false; if(debug) {...}
 
bool constexpr DEBUG = false;
 
@kbok Not if the log level is set at runtime
@DeadMG sure, that's another way to do it.... But again, Java doesn't have lambdas :)
 
@jalf But then, macros can't save you can they ?
 
@jalf Java 8 does
 
2:21 PM
#ifndef NDEBUG
bool constexpr DEBUG = true;
#else
bool constexpr DEBUG = false;
#endif
 
@kbok they could simply wrap the if() part, and then they would
@TonyTheLion You mean "Java 8 will have lambdas"
 
@kbok They could at least turn something like debug(str1 + str2) into if(debug) { log.debug(str1 + str2); }
 
@jalf oh I thought it already existed
 
It's not out yet, and given their track record, I'll believe it when I see it ;)
@TonyTheLion not afaik
 
2:21 PM
Oh yeah, right
 
Arrrgg I want static if.
2
 
Hasn't java lambdas been on the list for like the last 3 versions?
 
I want a life
because I don't have one
 
@Collin pretty much, yeah
 
@TonyTheLion Make one.
 
2:22 PM
lol
 
@TonyTheLion you’re a cat, you have nine.
 
Rumors have it that they're actually serious about it for Java8
 
@daknøk oh yea
 
> C/++
 
Fucking J***.
 
2:23 PM
?
 
@daknøk D has it
 
@daknøk D has a static if
 
:)
 
@Nils @DeadCicada I know.
But C++ does not.
 
fuck D, it's buggy as shit
 
2:23 PM
So far I have been too lazy to learn D.
 
0
A: Get time/date from server with sntp(windows c++)

dualedSockets in C/++ are somewhat less pleasant than in most other languages, especially interpreted and the newer compiled ones. Why not use the official implementation from http://ntp.org/downloads.html Of course, NTP requires MinGW, but there are some libraries out there. http://www.hillston...

 
@daknøk C++ is for the mentally impaired.
2
 
I know.
Haskell ftw.
 
@Fred once tried to play with D, he found a bug in the first five minutes of using it
 
@TonyTheLion The inline unit testing is kinda neat
 
2:24 PM
OH THE REPWHORING
0
Q: select python or C++

mazen.r.fif i have a string x='wow' applying the function add in python : x='wow' x.add(x) 'wowwow' how can i do that in C++ thanks

 
bwhaha
u jelly?
 
-1
A: select python or C++

hexiststring x = "wow"; x += x cout << x << endl;

dude.
 
@kbok THAT TITLE IS TERRIBLE
WTF
@kbok ;.
 
missing semicolon. std imported into global namespace.
 
std imported into global namespace? Prove it.
using std::string;
using std::cout;
using std::endl;
 
2:27 PM
@kbok y u no comment on downvote?
 
Whatever.
 
Why was this downvoted? — John Dibling 38 secs ago
fair question
 
Like I said, harsh today. It's better than those guys doing x = x + x
 
I think anybody who's going to complain for the downvote knows what is wrong with this answer.
 
@Collin why is it better?
 
2:28 PM
@LuchianGrigore purrrformance
 
@LuchianGrigore += doesn't involve creating a temporary
 
@LuchianGrigore readability
 
@daknøk @Collin did you measure?
 
@LuchianGrigore more idiomatic
 
x += x is much more readable than x = x + x
Doubt that.
 
2:29 PM
@Cicada A pity that D sucks terrifically
 
I’m sure of it.
But yeah, if you call your strings x there is something wrong with the readability of your code anyway.
 
readability is subjective, so a non-argument
You can only bring up performance if you measure
 
I think that wheels::concatenate_string_with_itself(&&x); is much more readable.
 
@DeadMG Get cracking on your Wise
 
2:33 PM
thinking about it
 
The single thing I don't like about it is the type inference
I like type inference for small chunks of code (lambdas)
 
And now it's upvoted. mehcakes
 
Blblblblbl.
 
But for the rest I really want my static types, it makes the code much more readable (IMO)
 
2:34 PM
you can have them if you want
the grammar/semantics do support statically fixed types
 
@Cicada type inference and static types is completely orthogonal
 
@jalf Worded better: I want to see the fucking type names
 
I think she means statically specified types.
 
@Cicada: Some of them maybe. Don't lump us all in the same group. — John Dibling 4 mins ago
 
kbok y u so mean
 
2:35 PM
@Cicada Indeed, the Lounge dwellers are an abrasive subset of the C++ community.
 
@EtiennedeMartel Je ne le visai pas. Ca me fatigue les gens qui prennent des simples phrases pour des généralisations.
Next time I'll put simply "all C++ programmers are morons" and he'll probably have a reason to get vexed.
 
Also
Seems a bit extreme to me. — John Dibling 9 mins ago
 
@EtiennedeMartel hardly, we are a course subset
 
oh come on.
Like he's gonna cry.
 
@LuchianGrigore I have now, += is much faster than +
 
2:43 PM
@Collin That's normal and is probably always the case with non-trivial types.
50% speedups are common.
 
That's news to me.
On a totally unrelated note, I'm gonna go refactor some code now....
 
On the CUDA project I used to work on, I would split barycenter calculations into 1 operator per line
Got 30% speedups
 
@kbok Well, downvoting for a missing semicolon (which is pretty much guaranteed to be a typo) is extreme. You could have simply edited it, ya know.
 
@LuchianGrigore It did turn out that if the inner of that loop was x += x or x = x + x, speed was pretty much the same. I assume this is because doubling the size of the string required a re-allocation every single time around, which was the same as creating the temporary on the RHS of the slow version
 
@EtiennedeMartel but you shouldn't edit for trivial things :P
 
2:47 PM
@thecoshman Arhem.
 
But for most of the loops in the ideone test, there wouldn't have been a realloc in the x += concat case.
 
9
A: Adding new lines to Alert text

thecoshmanIf it is anything like most languages, then you only need to have \n to get a new line. having \\n is saying that you actually do want to draw a \ because normally the back slash is used to say your about to do some thing special.

-1 > "your" instead of "you're"
 
Greetings!
 
@thecoshman "the back slash is used to say your about to do some thing special." <- will not edit
awww :(
 
@LuchianGrigore I'll have that back now please
 
2:49 PM
their you go :P
 
@LuchianGrigore there?
 
@TonyTheLion Scandalous
 
@thecoshman :| sarcasm
 
@Cicada yea pretty terrible
 
2:54 PM
Spoiler: apparently when it comes to advanced SVG, Opera and IE lead the pack. Go figure. http://voormedia.com/blog/2012/10/creating-svg-vector-graphics-for-maximum-browser-compatibility
^ Duh what else is new
 
@EtiennedeMartel Sorry, I was too busy repwhoring
 
@TonyTheLion exactly why I pirate everything.
(And I have no credit card for the iTunes Store.)
 
@kbok I guess so, you silly otter.
 
I don't rep whore anymore. I just sit back while my old questions and answers continue to get upvoted. The gift that keeps on giving.
 
@EtiennedeMartel It's just a question of effort. The poster posted a trivial two-line chunk of code. It doesn't even require to think a little bit. I don't think it deserves a comment, or an edit, given that when it was posted there were other equivalent but valid answers.
@Chimera I want close votes.
 
2:56 PM
@kbok You could at least cancel your downvote, now that it compiles.
 
@Pubby You've been mentioned!
Stack-based template metaprogramming in C++ (11). http://pubby8.wordpress.com/2012/10/15/stack-based-template-metaprogramming-in-c-11/ #cpp #cpp11
2
 
@EtiennedeMartel Fair enough
 
@kbok it is interesting that (1) all three answers are wrong, and (2) the closing of the question is wrong.
oh wait, it's not interesting
i'll just add a comment
 
@Cheersandhth.-Alf What's wrong with Lucian's answer ?
 
@melak47 are you there my friend?
 
2:59 PM
@CSharper ....yes?
 
I have incorporated your feedback
 
@kbok he updated x
 

« first day (737 days earlier)      last day (4202 days later) »