« first day (793 days earlier)      last day (4381 days later) » 

15:01
@Zoidberg'-- Also, do you want to test the condition without synchronizing first?
So I guess I'll need a shared unordered_map to associate each thread id to a context and then check it each draw call? Sounds ugly.
user142019
@R.MartinhoFernandes I just want to block the current thread until the condition variable is notified.
user142019
That's all I want.
@Zoidberg'-- Create a local mutex and lock. I've been there :/
What?
If you create a local mutex, how can you notify it?
15:03
You notify the condition variable.
But that is local too.
Oh wait.
I thought you had to pass a lock in the constructor.
Anyway, sounds like you are using the wrong tool.
Maybe you want future<void>?
threading...
@R.MartinhoFernandes future thumbs up
Because it clearly seems like you have no condition to check.
user142019
@R.MartinhoFernandes hmm I didn't know it had a public ctor. I thought it was for use with std::async only. I'll try that.
@Zoidberg'-- The default ctor constructs an empty (invalid) future.
You need to use a promise/future pair.
The waiter gets the future, the notifier gets the promise.
15:07
Heard today during an oral debate over C++ features : "C++ references are useless. You should always use pointers ! At least you can set them to null. Try to do that with a reference !"
lol
@R.MartinhoFernandes The customer gets the bill
"You should always use a Car. A least you can drive it. Try to do that with a fridge !"
@Zoidberg'-- So basically, no, future does not have a ctor that you can use to create a usable future. You always need to obtain one from some other primitive (promise, packaged_task, or async).
user142019
Ah okay.
15:09
Bleh, operator() should have const qualifier by default
The robot seems to be buggy.
std::promise<void> promise;
auto future = promise.get_future();
std::thread t([&promise] { blah(); promise.set_value(); });
do_stuff();
future.get();
Something like this.
they could have called it a bit different.. promise/future?
A bit optimistic, aren't they?
Those are common names for these primitives.
std::packaged_task<void()> task([] { blah(); });
auto future = task.get_future();
std::thread t(task);
do_stuff();
future.get();
Probably better.
This way you won't forget to fulfill the promise.
Is there an easy way to initialize an array with a certain object for each element?
The only way I can think of involves silly variadic recursion with indices
15:16
Ah, nice, future has a wait function. That is more readable.
@Pubby How do you get that object?
@R.MartinhoFernandes I want a function make_array(T)
Ah. Gimme a sec to find it on my answers.
@Pubby Oh wait, the same object in each element?
@R.MartinhoFernandes Yes
Still doable.
12
A: Initialize std::array with a range (pair of iterators)

R. Martinho FernandesWith random access iterators, and assuming a certain size at compile-time, you can use a pack of indices to do so: template <std::size_t... Indices> struct indices { using next = indices<Indices..., sizeof...(Indices)>; }; template <std::size_t N> struct build_indices { ...

You can do something like in the last snippet.
Hm, okay
user142019
15:19
Crap I have a race condition. :D
thanks
@Zoidberg'-- See your doctor
user142019
Unexpected exception with message: 'Operation not permitted'
user142019
Once again, exceptions are helpful as fuck.
user142019
Time to install a debugger.
user142019
15:26
Wat. std::thread::thread throws.
user142019
Oh wait I forgot -lpthread.
user142019
Oh cool now the dtor throws.
Threads must be joined or detached.
Why don't you just use async?
user142019
I am joining it.
user142019
What happens if you join a thread and it has already ended?
15:29
Nothing.
When you say the dtor throws, do you mean std::terminate?
user142019
Uh yes. :P
That happens when the thread is destroyed in a joinable state.
user142019
Hmm.
user142019
Ohh wait I think I know what's happening. Something throws an exception before I join the thread.
3 mins ago, by R. Martinho Fernandes
Why don't you just use async?
In case you haven't noticed yet, std::thread is very finicky to get right.
user142019
15:33
I have noticed. :P
In case you haven't noticed, he noiticed.
meta noticed
user142019
Ah promise::set_value throws.
user142019
Let's see.
Why don't you just use packaged_task?
15:34
@R.MartinhoFernandes packaged_task... I really need to put that book on the list for christmas break
Scroll up for example.
All that said, std::async can be a bit tricky as well.
@R.MartinhoFernandes std::thread(std::move(task)).detach(); would that have merit?
Hmm, yeah, I forgot to move. Detaching avoids the need to join. It is quite a mouthful though; std::async is better :P
Or not. This is all very messy.
@R.MartinhoFernandes Also, async has a more flexible specification.
there's some work-stealing ... something which it can do, but std::thread can't
But async suxors because you need to grab the future yourself.
std::async(std::launch::async, fun);
do_stuff();
// runs sequentially, using two threads :(
user142019
15:42
Screw this. I'll use Erlang. :^)
auto dummy = std::async(std::launch::async, fun);
do_stuff();
// fixed
user142019
if (::fork() == 0) ::execlp("erl", nullptr);
std::exit(0);
// fixed
it's cold
user142019
it's hot
15:46
So, yeah, both async and thread have broken interfaces :(
it's mild
user142019
it's humid
it's suckage
user142019
it's the vacuum cleaner!
it's an industrial-grade vacuum packer
user142019
15:47
it's a combobreaker
user142019
lol
I wonder how async can be fixed without leakage or complete reimplementation, though.
thread is easy to fix: just make a wrapper that joins on the destructor (or does nothing if detached).
But async is harder if not impossible.
Because you want to prevent the dtor of the future from running, yet you cannot prevent it from running because it may need to release resources.
It's a Honda 1.25hp 4-stroke centrifugal pump and a Hoselock 200W submersible electric pump. I still don't have enough suckage :(
You could fix it by spawning an extra thread to run the destructor in, but that is clearly a fucked up solution.
I honestly don't know anything about the Standard threading facilities
but I'm starting to think that's a good thing, not a bad thing.
15:54
Yea, sounds like you would have threaded in wrong territory
hehe
Oh, you can also fix std::async with a macro.
@TonyTheLion That may actually be the bestest fix. Sigh.
ewwww
macros
@R.MartinhoFernandes eh :(
Is __COUNTER__ standard?
Dammit.
Whatever.
#define ASYNC(...) auto THAT_ANONYMOUS_VARIABLE_MACRO_ANDREI_USED_IN_THE_STUPID_SCOPE_GUARD = std::async(__VA_ARGS)
15:57
lol
That's probably __LINE__ .
yeah, __LINE__ would be fine.
Nope.
ASYNC(blah); ASYNC(bleh);
you'll just have to disallow that
15:58
lol
__COUNTER__ is probably available everywhere except Hell++.
Macros ugliness
#define ASYNC(...) auto BOOST_PP_CAT(prefix, __LINE__) std::async(__VA_ARGS);
or use __COUNTER__ on supporting platforms and __LINE__ elsewhere
Someone should make a proposal to standardize it, because it is a de facto standard.
wait, couldn't you just add a new line?
#define ASYNC(...) blah \
then the next one will be on a new line
16:00
That does not change the __LINE__ because that is the original line number, not the one after expansion.
oh well
I am fine with __COUNTER__.
wait, you're telling me to ?
:P
Still, it's not a proper fix.
Not even the fucking macro is good enough.
It still blocks.
The only difference is that it does so at the end of the scope now.
If I want to block I can simply .get().
16:03
Blocking in the destructor takes that choice away.
Yeah, I'll just give up.
The macro does fix the problem of accidental non-parallelism.
214 points 1 hour ago*
why is the * there in some cases and others not (on Reddit)?
C++ Builder with Clang? What the fuck
The world is really ending
Remember, many webcams are equipped with an "on" light. Pay attention: If that light is on, but you're not using your camera, something may be amiss.
no shit?
@CatPlusPlus yes. Your hopes and dreams may finally come true.
16:11
I don't have any hopes and dreams
oh wow, you're worse off then first realized
I also still don't have any food
Why is that shop so far away
so you get some excercise :)
Online junk food it is
16:14
guys im trying to generate assembly with vs2012. I set Assembly Output to /FAcs under project's Configuration Properties > C/C++ > Output Files, but after the successful build, I cant find *.asm files in release directory. Any ideas?
@R.MartinhoFernandes Not capturing the return value of async is a choice.
@StackedCrooked What?
Intermediate files are kept in intermediate output directory, not the final output directory
That includes assembly listings
@StackedCrooked In case you are not aware, that choice means running sequentially.
@R.MartinhoFernandes auto a = async(...); vs async(...)
16:16
yeah that is set to Release\Tmp
Future joins on destruction
@StackedCrooked Yes, the latter is worthless.
@R.MartinhoFernandes Yeah, that's my point. It's the choice for running sequentally.
tbh
@StackedCrooked Wut.
16:16
joining on destruction is a dumb idea, I mean, the user can't use the value anymore, so why wait for it to be computed?
It's a bad choice, but it's not a bad design IMO.
I thought the choice for running sequentially was to call the function directly.
Why the fuck would I write std::async(std::launch::async, fun); when I can write fun();
async ever doing sequential execution is retarded
16:17
@CatPlusPlus, it creates the *.obj and other intermediate files there, except asm
That is a choice that should not be in the interface.
Then I don't know
You're doing something wrong
Read docs or something
The fact that you can easily get absolutely nothing out of std::async by accident is a clear indication of a bad design IMO.
Did you write your own async yet
No.
Was pondering how to fix it externally some minutes ago, but turns out you can't.
16:19
async sucks
so IOW
back to boost::thread
I'm looking to keep using the PPL for the imminent future
ok, is the assembly file type *.asm by default in VS?
dude, who are you talking to?
no one is remotely listening or interested, so ask on Stack Overflow
16:21
So much snow outside.
@TonyTheLion The cat showed some interest above.
hmm
I need some graphs of how incredibly slow it is to iterate through a std::list.
What the fuck do you need that for?
16:22
@R.MartinhoFernandes seems like he lost interest already
writing a tutorial on it, obviously
Oh.
Just slap a big "std::list sucks. DO NOT USE." and call it a day.
@DeadMG It's O(n).
lol
Oh, wait, you wanted for a particular implementation?
16:23
no
I wanted to showcase it's cache-devastating effects
Because you can't really benchmark a reference.
@TonyTheLion, certainly not talking to you.. so calm down :)
Seriously, the only uses for linked lists imply the people involved do not need your tutorials. Nothing personal.
I know
but I'm attempting to explain that to the people who do
"Use vector or deque. Don't use list"
16:24
Like that cliffski dude? :)
There you go
@R.MartinhoFernandes Indeed.
fatal error lnk1158 cannot run 'rc.exe'
anyone ever seen that ^ in MSVC
@DeadMG There was some on reddit a while ago
You fucked up your MSVC
16:26
@R.MartinhoFernandes I think the only legitimate use for a std::list is when you want your iterators to remain valid after modifying the list.
@EtiennedeMartel Eh. Sometimes you want to use it to guarantee O(1) complexity for an operation- like inserting into a hash table.
and I'd secondly argue that pool allocators can substantially reduce the problem.
1
A: How to best overload operator < > <= >= but only write one or two comparison functions?

ZetaYou just need the equality and the lesser comparison operator. The rest can be generated automatically with std::rel_ops, since the following holds: a != b equal to !(a == b) a <= b equal to (a < b) || (a == b) a >= b equal to !(a < b) a > b equal to !(a <= b)

@DeadMG Can pool allocators also solve world hunger?
no?
Didn't we conclude a while back that std::rel_ops sucked or something?
16:28
@R.MartinhoFernandes Why? I never heard of rel_ops until today.
@DeadMG Damn. I really had the feeling they could solve any problem.
@Pubby This seems to indicate such a conclusion was reached by at least me: chat.stackoverflow.com/search?q=rel_ops&room=10
Ah, got it. Time to comment.
@thecoshman icantread?
@R.MartinhoFernandes I don't like them either, but the question seemed like he wants to hear about rel_ops: "(1) just write one or two functions, such as the one for operator < (and ==), others can be automatically generated."
Oh, it's your answer.
Well, I commented on it with some information you may want to add to the answer :)
16:32
Wow. rel_ops sucks.
0
Q: Bool casts in `std::rel_ops` example?

Andrew Tomazos - FathomlingConsider the std::rel_ops example here: http://en.cppreference.com/w/cpp/utility/rel_ops/operator_cmp #include <iostream> #include <utility> struct Foo { int n; }; bool operator==(const Foo& lhs, const Foo& rhs) { return lhs.n == rhs.n; } bool operator<(const F...

5 mins ago, by R. Martinho Fernandes
Didn't we conclude a while back that std::rel_ops sucked or something?
:)
There's Boost.Operators
(Listen to Pete Becker, he is a stdlib implementor)
Jun 13 at 16:21, by R. Martinho Fernandes
It's an internal implementation detail that somehow leaked into the standard.
The ideal solution is of course to generate your C++ code from a better language
16:35
Such as the C preprocessor
So, does GCC stands for GNU Crap Collection?
Also accept your invites scrubs
did you guys see the Sun's headline for the recent North Korea rocket test?
16:40
What invites?
I want invites.
"Will world end, Bangnam style?"
6
The world will end with PHP becoming an ISO standard
@DeadMG Dear fuck.
@CatPlusPlus Don't give them any ideas.
16:41
Don't they know that Gangnam Style is South Korean? And that the joke has been overused?
Mostly the second part.
how do you set the time in the youtube video?
The Youtube video?
I've come to the conclusion that wherever you are in the world, any newspaper or news network with "Sun" in its name is shit.
Is there an ultimate one to end all videos
@DeadMG Append #t=xxhyymzzs
any newspaper or news network with "Sun" in its name is shit
Wow, that negativity seems to be shared by all cats.
@CatPlusPlus You know, I could somehow predict you were going to say that.
You're becoming so predictable I fear you're turning into a parody of yourself.
9
It's not hard to predict what the Cat is going to say next
6
16:46
My guess is "potato".
Your mom
Dammit. Thankfully I did not bet with anyone.
@EtiennedeMartel Oh no my internet fandom
I don't think he realizes how negative he really is, he's saying it so much, he probably doesn't think about it anymore.
Was I supposed to star those comments? I don't fall easily to peer pressures
16:47
oh I realized what I said earlier... LOL :)
lol
stop fucking up the stars
Twinkle twinkle little star
@Pubby: I still don't get why nobody else upvoted your CRTP answer.
Maybe nobody likes CRTP
Maybe nobody likes pubby :(
But everyone loves fobby.
16:52
fobby is my rolemodel
I have never heard of fobby
user142019
Hurray std::enable_if hell.
@TonyTheLion You should play EarthBound.
foppy
16:54
@Pubby Yeah, that's the red version.
user142019
fappy
:thejoke:
oh no
how did I not think of that joke?
Cocaine is a hell of a drug.
side effects: death
16:56
And taxes.
Guys help me concentrate
@Crowz Plonk
wat?
Is there a difference between static bool myvalue = false; inside a class declaration and the same line outside of any class declaration ?
(Except for the declaration/accessibility scope of course)
17:12
Is anyone familiar with statistics?
@Crowz Somebody'll be, shoot
well it depends on what the question is @crowz
@Crowz I remember doing some during my degree.
It's a pretty big prerequisite for AI.
Anyone remember the t-test, f-test, all that jazz?
You mean Student?
17:15
@Crowz Fortunately my mind has allowed me to forget all of that
That or I never studied t-test and f-test, I can't distinguish the difference
ugh this is painful to concentrate on
@Neil It's roughly the same, the main difference is the distribution you apply the test on.
IIRC.
I also don't rem these series
what is "s"?
A letter
It's part of something called alphabet
17:19
affirmative
You can read more on it here:
An alphabet is a standard set of letters (basic written symbols or graphemes) which is used to write one or more languages based on the general principle that the letters represent phonemes (basic significant sounds) of the spoken language. This is in contrast to other types of writing systems, such as logographies, in which each character represents a word, morpheme or semantic unit, and syllabaries, in which each character represents a syllable. A true alphabet has letters for the vowels of a language as well as the consonants. The first "true alphabet" in this sense is believed to be th...
It's quite useful
Hah in terms of statistic ya wankers
Statistically letters are used very often
@Crowz standard deviation
I thought that was mu? What is mu?
17:20
A sound cow makes
Cattle (colloquially cows) are the most common type of large domesticated ungulates. They are a prominent modern member of the subfamily Bovinae, are the most widespread species of the genus Bos, and are most commonly classified collectively as Bos primigenius. Cattle are raised as livestock for meat (beef and veal), as dairy animals for milk and other dairy products, and as draft animals (oxen or bullocks) (pulling carts, plows and the like). Other products include leather and dung for manure or fuel. In some countries, such as India, cattle are sacred. From as few as 80 progenito...
Nah cows here in America say moo
This is turning into an epic moment
haha true
TIL cows in America speak dialect
I believe it's slang
17:22
@Crowz $\mu$ is usually the mean value. $\sigma$ is the standard derivation.
They're helping you concentrate
But in this specific case I believe you $\mu$st find the answer in your lecture notes
@sehe Well, cats in NA say "meow", and in Japan they say "nyan".
@EtiennedeMartel In italy, cats say "miao" which is pronounced the same way, but oddly written like ciao
There's this formula for the t-test: ((x with a bar over it) - (mu)) / ((variance / sqrt(sample size))
17:24
@Neil In French, it's usually "miaou".
(But I'll be honest, it actually sounds like "maow")
Cat dialects!
Them French cats are classy
And in Poland, cats sound like "This sucks".
There's this formula, too
I don't into chemistry :(
2-methyl propane
17:26
Isobutane
Butts
@DeadMG isobutene sound nice
@RanaTallal Isobutane. Isobutene is something else.
what is alpha in terms of statistics?
@Insilico .. no wonder I hate chemistery
@Crowz Significane level, I think.
Or maybe it's 1-alpha that's the significance level. I don't remember
17:31
Er. I'm just gonna go to the tutor. Fuck this.
Alpha, coincidentally, is a letter also
But from a different alphabet
Did you know alphabet is called like that after alpha and another letter, beta
@ereOn What else would be left? Lifetime? That's the same.
@CatPlusPlus MOO
17:33
@MooingDuck Bwoo
@EtiennedeMartel "Paczkowski said it did not take long to realise his mistake."
@ereOn there's one meaning for static inside classes and functions, and a completely unrelated meaning for static outside of both.
user142019
execvpe y u no const-correct.
Hahaha expecting any correctness from C/POSIX
user142019
Ah well, const_cast to the rescue.

« first day (793 days earlier)      last day (4381 days later) »