« first day (2050 days earlier)      last day (2897 days later) » 

...I just used an IIFE inside a while loop condition. I feel dirty.
 
Especially so since it acquires a lock.
 
@Griwes You should.
 
in my defense, though
it does have a comment above
// shenanigans
while ([&]{
 
7:14 PM
I commited some code today at work with // So ugly I want to cry
True story.
 
In the previous project I worked on we had a commit message format that had a line called "REFERENCE", where you could mention what issue, or client issue, or feature, or whatever else this commit is a part of.
There was also a catch-all thingy called REFERENCE: IN SW ......, where you could put anything in the place of dots, and it basically meant it's a standalone commit that shouldn't be tracked as an important one.
 
I guess I know how it ends.
 
At some point there was a commit that disabled some locking to avoid a deadlock at startup, because we had to push this further even when we knew it was terribly broken.
how was the syntax for that here
 
@Borgleader Here's one that makes you go, HUH!?!?! stackoverflow.com/questions/37490340/…
 
meh.
The commit message said REFERENCE: IN SW DIRTY HACK GREAT SHAME
:D
 
7:18 PM
:D
Damn, you beat me to the smiley master race :(
 
@ScarletAmaranth Congrats :)
 
@StackedCrooked thank you! :)
 
I never managed that. I just got a job after finally getting my bachelor's degree.
 
it doesn't feel any well to be honest; the best part about uni was meeting my lady
 
user1804599
7:28 PM
I think I will add a player-following viewport to my dungeon crawler.
 
IDGI
 
ooooh
 
@Morwenn ew smartypantses
 
I added locking, but not removed the old locking.
headdesk
aaaaaa, my brain hurts from trying to figure this out
locking is hard, kids
 
nwp
7:40 PM
@Griwes I'm working on something that makes it better, I'll probably share it in a few month's if it actually works
 
lol
dammit I might need to do try_lock
and that's never good
welp
 
nwp
once you make an is_locked-function all is lost
 
If a StackOverflow question is obviously a bad/duplicate one, is it still okay to answer it?
 
all is lost already
unless... I temporarily unlock the lock in one place...
hmmmmmmmmmmmm
 
nwp
@BarrettAdair if you are desperate for internet points answer it, otherwise flag it as a duplicate
 
7:45 PM
@nwp Ok, thanks.
 
            lock.unlock();
            auto && ret_value = (*state->function)();
            lock.lock();
            state->value = std::move(ret_value);
            lock.unlock();
This code is terrible, right?
 
:D
The best part is that it might be what I need to do.
 
nwp
@Griwes assuming state->function takes up significant time it doesn't seem terrible, keeping the lock scope to a minimum is good
 
Oh, and lock is an unique_lock and that whole thing is within a try {}.
oh hey, tests don't explode
(though that doesn't say much since I only test with a serial executor ;_;)
 
user1804599
7:48 PM
Ido has exceptions. Fuck Ido.
 
Super simple stuff.
 
HEY THAT ACTUALLY WORKS
I need some actual parallel tests for the futures though, I guess ;_;
 
Empirical science at its finest
 
I kind of expect it to randomly explode at some random points in the future...
but hey, that's threaded code right
ewww crap, it actually deadlocks in the full usecase
 
nwp
@Griwes using thread sanitizer?
 
7:53 PM
no
 
nwp
> Typical slowdown introduced by ThreadSanitizer is about 5x-15x. Typical memory overhead introduced by ThreadSanitizer is about 5x-10x.
 
I'm afraid it'd yell at me badly.
 
nwp
ouch
still worth it I think
 
oh my dear
this is gonna be fun
since all the worker threads are waiting for a CV notify
Which means that something is not put on the thread pool.
 
user1804599
@sehe Your mom super simply stuffs her mouth full with hamburgers.
 
user1804599
7:57 PM
What do you call someone who steals a hamburger? A hamburglar.
 
user1804599
> Hitlary Clinton
 
nwp
@Griwes maybe you can try the thread annotation thing, has no runtime cost and should be compilable with a few macros elsewhere too
 
@nwp Hmm.
Ugh, I managed to already forget that GCC crashes on the simplest cases of lambda trailing return type SFINAE :/ /cc @Morwenn
whaaaaat
I added a branch that does std::terminate and it started working.
 
nwp
8:14 PM
@Griwes sounds like interleavings are messing with you
 
Let me try to noexcept this bitch.
Wait what. Why did that even matter, it was in the generic version of that function that isn't even called in this program.
Eh, cannot reproduce anymore :(
I'm too tired for this shit.
 
Is const int[10] a const type?
 
most probably, yes
hmmmm
the quote in the accepted answer on your latest question says otherwise
 
8:44 PM
Do you guys have some tax you have to pay for some public TV in you country?
 
yes
 
In the form of "if you own a TV you have to pay"
 
we have a licence fee which you must pay to watch TV, which pays for our public broadcaster.
@Shoe Not own, watch. Using a TV for other purposes e.g. games console doesn't count.
 
Here if you own a TV you have to pay
Independently from if you use it or not
And nobody ever paid
 
user1804599
@Shoe There's a government-funded (i.e. tax payer-funded) propaganda channel called NPO in the Netherlands.
 
8:45 PM
it's dumb really
 
user1804599
@Shoe Oh no we don't have that I think.
 
So know if you own electricity you pay this tax by default
 
assuming that taxes for a public broadcaster actually makes sense, they should just levy it as a general income tax.
 
Unless you legally declare not to have a TV
 
user1804599
Public broadcasters are dumb and must be forbidden.
 
8:46 PM
Yeah. I don't think they make sense anymore
 
user1804599
Government must never fund media. Media must be free from such influence.
 
pfft
as far as I can see, most media just finds other influence
 
user1804599
And stop farting.
 
if they were actually uninfluenced I'd agree with you
 
user1804599
Also unfair competition.
 
8:48 PM
not really seeing it
 
70 Talks submitted so far, Voting tool is almost ready. Just this unicode problem... m(
 
user1804599
Phosphorous is nice.
 
Professional as ever
 
doesn't the BBC's funding come from the TV tax specifically so the government can't easily influence their budget?
 
Ven
Hi
 
9:00 PM
hey. Thanks for the floof :)
 
9:21 PM
@jaggedSpire Possibly.
but the government does anyway because they make the goddamn law.
 
alas, the problem with government is government
 
nwp
here you have to pay for public broadcast channels if you rent a flat or have a house, doesn't matter whether you own a TV
 
Ven
@jaggedSpire :D
 
In Canada, the "Ministry of Canadian Heritage" (yes, that's the real name) gives several hundred million dollars to the CBC.
Then the CBC has to turn around and sell ads because that doesn't cover its operation costs.
 
user1804599
9:43 PM
Why aren't cars made out of titanium?
 
I have no fucking clue. Why are you reading the periodic system?
 
user1804599
Ik wil sjoemelsoftware maken.
 
user1804599
@sehe No, I'm watching it.
 
Ampele opportuniteiten lijkt me
@rightfold Euhm, je ADD een beetje doorgeschoten? Misschien moet je samen met Francis gaan binge-youtuben
 
user1804599
Ja, m'n ADD-instructie resulteerde in een overflow.
 
9:47 PM
0.5 points awarded
 
nwp
dutch es fonnnneh, uou jost meeespeel wards uand et lookes goud
 
Ga in de leer bij Scott
 
apparently car crumple zones are commonly constructed with titanium, though steel is also common.
 
That is cool info
 
According to wikipedia the chassis is usually either carbon steel or aluminum alloy
 
9:49 PM
Security may cost a little
 
@rightfold Titanium is expensive. It's expensive to obtain to start with, and machining it is an utter nightmare compared to steel.
 
user1804599
I think jaws and skulls should be made of titanium instead of bone.
 
user1804599
Bone is really dumb.
 
user1804599
Titanium master race.
 
inb4 planet wide titanium depletion
 
9:50 PM
I think it would be very difficult to ingest the required amount of titanium before mining was a thing
 
@rightfold Bone (bone marrow, to be exact) is where blood cells are "manufactured".
 
actually bone is pretty impressive in its strength to weight ratio isn't it?
 
lol
VS2015 is so slow on my desktop (3x3.1Ghz & 16 GB MEM) and I can't even develop project for Windows 2000 on it. It's not a recommendation for a tool, I ask if it's possible (and how) to modify notepad++ in a way to have a features like auto-completion for functions and structures specifically in Windows API — gggggggg 53 mins ago
my best move is to build a gaming pc for running VS like the middle class big american — gggggggg 20 mins ago
 
because it's got that foam structure inside it's actually quite light
:|
lolwat
 
> The average Bentley driver owns 8 cars. The average Bugatti driver owns 84 cars, 3 jets and a yacht.
I'm tempted to say something is wrong there
 
user1804599
9:57 PM
@sehe Education is good.
 
Zeker
 
@jaggedSpire Considering the raw material from which it's made, yes. In the overall scheme of things, not so much.
 
@JerryCoffin thanks
 
user1804599
@sehe This channel is part of the Numberphile, Computerphile etc. set of channels
 
user1804599
same editor
 
10:07 PM
My kids urgently need to learn enough English
 
user1804599
send them to that elementary school that does 50% of everything in English
 
if they're willing to relocate somewhere close
 
user1804599
San Francisco
 
good start; slowly getting there. I'll wait
 
Ell
@rightfold I love Periodic Videos
sir poliakoff is awesome
however his name is spelled
 
user1804599
10:10 PM
@sehe have them watch Periodic Videos.
 
user1804599
They'll learn enough chemistry as well.
 
user1804599
> and 5, you'll notice if you're a mathematician, is half 10
 
Ven
yo
 
user1804599
Weird: water from the tap downstairs tastes nicer than water from the tap upstairs.
 
user1804599
I tastes a little more aggressive.
 
10:17 PM
@rightfold Lead is dense, so you're getting more of it from downstairs.
 
Ven
rofl
 
nwp
I don't know how to fix a cmake file
 
Ell
lead pipes are still in some homes
 
nwp
it does foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) and puts the wrong prefix folder there and I have no idea where to change that
 
@nwp what's broken
 
user1804599
10:20 PM
Use the rm tool to fix the CMake file, then switch to Ninja.
 
@doug65536 meanwhile at the boost mailing list:
> I'm surprised to report that I have not yet seen Fiber reviews or discussion.

One interpretation would be that interested parties are busy finishing
proposals for Meeting C++ or papers for the upcoming WG21 meeting, and
will provide Fiber reviews once they've dealt with the more immediate
deadlines.
 
cool
 
nwp
there should be some variable that is set to "/usr/lib" which should be set to "/usr/lib/llvm-3.8/lib" but grepping for "/usr/lib" showed nothing
 
cross platform fibers would be neat to have... might be too late though, we might have generators by then
 
nwp
10:28 PM
maybe there is an environment variable that cmake uses?
sucks being dumb
 
Whats a fiber compared to a thread?
 
you manually switch to it, no preemption
one thread can run one fiber, and it can switch fibers
 
@Mikhail Basically a manually managed thread. I.e., you write your own scheduler.
 
so... you could call a function (in another fiber), run half way through, switch back and make caller return, then switch back to it again, and continue where it left off
 
How can you avoid preemption on a modern system? Drivers and such and pause your process, also the OS.
 
10:29 PM
apis exist to switch context
it is like a context switch but you manually do it
 
@nwp you can see all variables used in a build by running cmake -LAH <rest of the parameters>
 
But doesn't the OS preempt everything when it wants to service things like locks?
 
your actual thread is itself preemptive
 
@Mikhail Run at really high priority. On Windows, you can set a priority so high that virtually nothing will preempt your thread (not even hardware interrupts).
 
think of it like nested threads within a thread, but you manually switch contexts in that "inner" threading system
the outer thread runs like a normal thread, preempted, etc
 
10:32 PM
Yes, this sounds like the old threading models in systems like Mac OS 7
 
you know yield in c#?
you can make that happen in C++ with coroutines (you can implement coroutines with fibers)
 
So, the real question is, whats the advantage compared to std::thread
 
nwp
@milleniumbug no /usr/lib in the environment variable :(
 
@doug65536 Yes, but you can also make that happen with std::thread, so whats really going on here?
 
user1804599
> you could say that iron is in my blood
 
user1804599
10:33 PM
oh god this guy is gold
 
user1804599
pun not intended
 
user1804599
Au...
 
@Mikhail you could do it with exec'd bash scripts too... coroutines switch context in 30 or 40 instructions
 
@Mikhail You can set your own criteria to decide which fiber to run next (among other things). Also, switching between fibers typically has less overhead than switching between threads.
 
I'm curious if this kind of thing can be implemented by the OS scheduler, rather than the language.
 
10:36 PM
it is <-- example api
 
Okay, so why can't we just have all our thread like objects fast?
Why can't everything be a fiber?
 
Ell
@Mikhail the point is to avoid OS scheduling
 
fibers are slightly memory intensive, if you have big stacks. but otherwise they are featherweight
 
@Mikhail I suppose in theory you could do that, but it would require that every application include its own scheduler (and the vast majority of programmers would be way out of their depth trying to write such a thing).
 
@Mikhail the new coroutine C++ stuff is supposed to be even more lightweight than fibers
because the compiler "knows" how much stack space a generator can need
typically with fibers you have some nice big default just in case, and often default is used
 
10:45 PM
So, where is the mechanism that actually changes the location of the instruction pointer register and sets the processing into motion? Does the OS handle that?
 
exactly <-- my user mode "manually implemented" coroutine implementation with generator helper class
only works in windows. was just a proof of concept, to see if it would really work. it works
at first stack checks blew up. fixed that and it worked
 
@sehe You complaining about smartypants? It's the hospital who's fouting from the charity.
Ok, I've no idea how to state that in English.
@Griwes Oh yeah, I tend to forget because I mostly don't use lambdas x)
 
The ew was about the scene. Smartypants was the objective attribution
 
Oh.
My bad then.
Maybe even « my mistake ».
FWIW
 
What is the point of a coroutine? What use case does it simplify?
 
10:52 PM
read the readme at the link I gave
that is classic case. another is easy implementation of state machines. for example, instead of one massive switch case lookup, or unpredictable indirect call, you could switch to code that is specialized for each state, which keeps its state in local variables
 
Asking in earnest because I've heard of them but have never used them.
I'm late to the conversation. How long ago did you provide the link?
 
Python-like generators are a simple example of the problems coroutines solve.
 
Ell
@JamesAdkison asynchronous io
well
asynchronous anything I mean
do_something().then([](){
   do_something_else().then([](){
        do_something_more().then([](){
            last_thing();
        });
    });
});
can be replaced by
 
@Ell Asynchronous without needing threads?
 
Ell
yield do_something();
yield do_something_else();
yield do_something_more();
last_thing();
or something similar
@JamesAdkison with or without
 
10:56 PM
In your example there is no order of execution requirement between the 4 functions,?
 
Welcome James
 
Ell
@JamesAdkison there is
 
yield doesn't mean yield execution. it means return a value but continue from here when they switch back
 
@Mikhail In an OS-implemented version of fibers, it's typically handled by the OS (e.g., SwitchToFiber on Windows). In a "green threads" library, it's typically handled (at least in C code) by using setjmp and longjmp to save/restore an execution location.
 
So what is the advantage to calling all 4 without the use of yield?
 
user1804599
10:58 PM
With coroutines (aka threads aka fibers) you can turn asynchronity into synchronity.
 
user1804599
That's what they're for.
 
Ell
@JamesAdkison there is no advantage really :V
 
int f() { yield 1; yield 2; yield 3; } f(); f(); f(); /* return values are 1, 2, 3 for those f() calls */
 
I probably shared it a few weeks ago, but it's so awesome :D
 
@doug65536 Okay, that is a little more clear.
So f() could define a set of specific transitions... each yield returns control to the caller and if the caller calls f() again it resumes where it left off
 
user1804599
11:02 PM
Yeah, that's how threads (aka coroutines) work
 
Ell
@JamesAdkison yes
 
yeah, and it can keep a really complex state in local variables or something, and effortlessly come back and continue
 
So, did I hear someone they are being added to C++?
 
user1804599
Pausing and resuming.
 
Proposed for C++17?
 
user1804599
11:04 PM
With std::thread pausing and resuming is done by the kernel. With Boost.Coroutine it is done by the program itself
 
@JamesAdkison yes
 
well, I am not giving up to date information. at least they were. no idea what will actually happen
 
user1804599
LLVM is a trainwreck
 
user1804599
iron is the future
 
nwp
11:07 PM
I give up for today
 
I give up forever.
 
@Morwenn What do you expect up to do with forever?
 
@JerryCoffin Er, I guess I'm to drunk to actually understand the subtlety of the question.
 
I think they were saying it as something called "up" was given to "forever" ...
 
nwp
@Morwenn never give up
 
11:10 PM
never surrender
 
@nwp Too late.
 
nwp
@Morwenn well, go with the fight club interpretation then. Once you gave up everything you are free to do anything.
I'm out
 
@nwp rule #1...
 
user1804599
I'm gonna produce and sell potassium roof tiles.
 
Ell
11:15 PM
lol
who would buy them?
 
user1804599
Exploding roof tiles.
 
user1804599
Super nice.
 
@rightfold Sounds cool :D
 
user1804599
@Ell chemically unconscious people
 
@sehe I have an idea for a skipper for PEG
 
11:21 PM
ok :)
 
in PEG notation, <expr> expr will skip any occurrences of the first expression in the second expression, regardless of where they occur
with one caveat, there can only be one skipper active at once
you you could do the following
 
that's what Qi does
 
program = <default_skip> program_impl
identifier = <> ([a-zA-Z0-9-]*)
the <> makes sure nothing gets skipped inside an identifier
 
I think it would be advisable to make the skipper 'scoped' (<expr>[expr...] e.g. or whatever syntax you got)
 
the skipper is scoped
it's just for the next expression
 
11:24 PM
@orlp the common term is "a lexeme" afaik
@orlp Ok
 
if the next expression contains multiple terms, you use grouping ()
 
I noticed
 
@sehe well, if you want to you can have a different kind of skipper for a lexeme :P
 
@doug65536 So, where in your code does the task run on another processor?
 
it doesnt run on another processor
 
11:26 PM
:-(
 
it switches this threads context
 
I'm soooo sleepy. See you later :s
 
that code is the same as really switching context though, missing a couple of things a real OS does (switch page mapping, segment registers/FSGSBASE, etc)
 
It looks very similar to a function call, just pusha (FASM) and then invoke.
 
@Morwenn G'night.
 
11:28 PM
What do you mean by a context?
 
yeah, context switches are exactly that
 
@JerryCoffin Thanks sweetheart :p
 
the cpu injects a "call" to an interrupt handler into your code
the interrupt handler switches to another stack
eventually it switches back and it returns to you
Yield(); switches away .... and eventually comes back
but with a coroutine you say which to switch to. otherwise identical
Yield() in that case means stop running this thread and return to me when you feel like it.
sorry confusing example
 
Yeah, I mean you could have just called the function?
 
meant pthread_yield()
@Mikhail no, you cant return in the middle of a function and continue from there the next time it is called
all of the local variables stay alive when the coroutine yields a value part way through
it "returns" yet all those locals are all alive and well
 
11:34 PM
@orlp indeed
 
But I think lexeme is when you don't skip anything
 
they do it with fancy code generators generating a class which carries state "across calls" but it's the same concept
@Mikhail it is not about parallelism, it is about control flow, and easier object lifetime control
 
Ell
@doug65536 it can be done with CPS transform right
^about control flow
 
11:37 PM
@sehe I'm not sold on the syntax though
 
this is hysterical
@orlp syntax is replaceable
 
replacable*
 
There you go. We meet in the middle
 
@Ell yeah. but in a way compatible with scope block lifetime of local variables
 
:P
@sehe maybe just - expr expr
 
11:39 PM
yeah a transform should be possible, I see what you mean. it would be a huge change to code gen. coroutines can be normal code
 
@orlp no way. That's making skippers mandatory at all levels. That sucks
 
@sehe why?
program = - [ \t\n\r\v]* program_impl
 
Or did you mean to include the - that's very hard to get from a chat message like that
 
yes, the - is the syntax that introduces a skipper
 
didn't you use it for anything else?
 
11:41 PM
well, it's used for ranges inside character classes [a-z], but that's unambiguous
 
yeah that's contextual. What do you use for negative zero width assert?
 
what does that mean?
you mean "not EOF"?
 
E.g. in spirit !char("35") >> int_ matches any int that doesn't start with 3 or 5
@orlp E.g.
 
oh that's just !
 
ok
 
11:42 PM
![35] int
 
@Mikhail Think of a function to generate Fibonacci numbers. You want to get a number, process it, then get another. With current code, you could use some static variables to save the last two numbers between invocations, so each time you called it, you get the next one. Coroutines kind of automate the process of making the variables static to save the state between invocations, so the function just sits in an infinite loop like: for (;;) next = a + b; a = b; b = next; yield next;
Fibonacci numbers are simple enough (and the current state obvious enough) that coroutines don't gain you much for this case. You can do the same with functions that have a lot more context, and a lot more complex code to create/manipulate that context though.
 
@sehe an argument could be made for allowing - inside identifiers (lisp-style identifiers), and using ~ for skipping instead
 
> When a libertarian masturbates to completion, does that technically make that dick a fountainhead?
 

« first day (2050 days earlier)      last day (2897 days later) »