@Meeper didn't even read it all, so went back to see what I missed, and it just gets better and better:
> look this number is less than this other number... why? I dunno... deeper analysis you say? not my profession, no sir, am professional compiler developer.
> printf is simple code that hasn't advanced technologically, i'm a professional compiler developer.
> you know what? screw it, logic who need it? celebrities right? glibc = GNU = FSF = RMS, and that dude is bonkers! politics am i right? daddy megacrop taught me this is how you sell the snake oil.
@Meeper
> i solved 2 cases out of bajilion, and they didn't accept my hack!
> there was a bug, ha! it's fixed now, but there was a bug!
> the standard library is part of the language standard, therefore can even be implemented as part of the compiler, but how dare they make their implementation dependent on their compiler!!!
> i love proprietary software and you can't fork glibc and make it proprietary ;(
> programming is too complicated, I can't be god and create my own perfect virtual world... i wish i was a hunter-gatherer instead...
don't you linearly combine pointers!
@amiloradovsky@functional.cafe nooo, can't add/scale pointers, not just cause of type system nerdery or lack of meaning, but cause they may overflow. You have no control of them so the usual excuse of "i keep em smol, so they never overflow MA LONG LONG DII..iigit", doesn't work. You can however control the size of memory allocation and have the excuse for differences, so convert the pointers to differences, carry out the equivalent of the weighted sum, then convert back, as long as you can guarantee you'll end up with a pointer in the allocated range, which usually implies a weighted mean, though can do some shenanigans with sub-ranges of a larger valid range. In C/C++ it's illegal to even form (not just dereference) a pointer out of range (sans sentinel end pointer, one past the last element), not that anyone cares.
@thestrongest the LAW of judge dread (which is judge dread enforced in place by judge dread) maybe has such concerns. Sane law however is often perfectly content with simply outlining exceptional situations that demand the attention of the court. The court is not a machine that calculates the law, because it's oh so difficult to comprehend it, the court makes actual decisions, because there are decisions to be made, that can even serve as precedent for new laws.
re: shower thought?
@amiloradovsky@functional.cafe @cstanhope what if it's a common mistake you keep repeating? How would you describe that? You fail to implement the knowledge into your subconscious. You fail to execute an algorithm you are clearly capable of executing. You're being stupid. It's fair to ask why is one being stupid while the other is not, but its unfair to call the word meaningless or stigmatize it.
For example:
Simple rule - do not stick your hand in the oven while it's hot. You are very much aware of this. When speaking of oven handling you will often give that advice to others, and yet routinely you keep sticking it, inevitable encountering something that was a bit too hot, reflexively pulling your hand away and hiting the top of the oven where the heating element are. Presumably you consider the scarring that lasts a mere week or two unimpressive, it's not that you are being stupid.
@georgia A fair judge would not see guilt in words alone, but motivations (an unfair judge you can't possible account for). Your question then becomes not of specific words, but of your own motivation, and you pondering on creep makes you suspect. If the eyes are of your coworker are indeed beautiful, then that is wonderful, enjoy them every working day. If you are unable to enjoy them without expressing your joy, specifically to a coworker who you see every working day and who's eyes you enjoy, then is it indeed the eyes that you enjoy or the prospect of seeing those eyes in your bed as a decoration, through coercion or otherwise?
I can realistically imagine, if you indeed enjoyed the eyes, the day either you or them quit, to have a conversation to keep in touch, in hopes to see and enjoy the eyes again, for which you would need nothing more than an occasionally meeting. Such conversation can be held without even revealing the motivation, out of tact. If this does not fit your case, and you proceed with your out of nowhere and going nowhere complement, one may at some point at the very least accuse you of lying about your feeling, and anything further you would say in your defense one may use against you in this meta-court of intrigue.
@leyonhjelm @anti @overflow for the brief period of time I remember myself considering the existing of "granpa winter", the crucial and most memorable aspect of it was the mystery. How did he know who's good or bad? How did he know who wanted what? How did he produce and deliver everything? What else was he capable of? The pursuit to even catch a glimpse of this force of nature was far more thrilling and exciting than the presents themselves. A family friend leaving the presents at the doorstep, running away before we could get to the door and shining a light from a far, left a greater impression than any elaborate explanation, movie, cartoon or a dress up act. If you focus on such things instead of religious dichotomy of good and bad and its material consequences, your kids will question him and his methods as much their own worthiness or your truthfulness, all in hypothetical. There will be no conflict.
re: pondering (in)equality, long rant
@amiloradovsky@functional.cafe Well, you saying that it's about higher comfort, implies that you know the expenditures, not just the income. Otherwise you wouldn't be certain it's higher comfort and not medical bills or "inherited" loans. I initially interpreted it as "this number that is twice my number, must mean higher comfort" which is not universally true, unless the difference is taken to an extreme.
I read the other replies, but didn't get this context of donation. In that case I would say that even the trivial measure of wealth is uncertain. The donors might decide to stop on a whim, so if you want to support someone today and are able to do so, you should, since tomorrow you or other donors might not be able to. One could call it subjective income, in contrast to objective, where one would be paid for the job done, regardless of how "likable" or "worthy" they are otherwise.
boring c++ porn
While I could maybe chase after this to a potential bug report, I think it wouldn't be taken seriously, especially if I'm pressed on a use case, which I myself consider dubious. It's also somewhat indicative that maybe my approach was not necessarily the best for this kind of an experiment. I went with forwarding, in my implementation of visit_first, since that's the standard for any kind of transparent wrapper function that's supposed to entirely disappear in most cases. Being a c++ standard however it has to handle references well, that can be used as mutable out parameters sometimes (the heresy!) and that is likely the crux of the problem. References to local variables make the job of the compiler much harder, so we're going to go with another common pattern, explicit value and move semantics - pass everything by value, use std::move to avoid copies. Getting rid of mutable references simplifies things quite a bit, but in general has a nuanced cost of the move constructor (though I might not be able to use any moveable objects either, due to non-trivial destructors, and have to stick with trivial value types).
This puts me back on track with gcc-10.2 now properly optimizing all the calls. Unfortunately this also means that visit_first is no longer a generic library function, it will have to stay in this project forever, and no longer living up to its current name, instead become funky_visit:
https://git.sr.ht/~namark/funky/commit/5e440f00d59cccd4b1dd66e6bf288e73314c7408
Also seems like clang doesn't do tail call optimization well unless you change the calling conventions (whatever that entails), so it's a win-win!
boring c++ porn
seems like forwarding in conjunction with std::get is what is confusing it... without forwarding it works fine... now to isolate and figure out whether it's a bug or a feature -_-
@georgia all clockwork always ran on lightning, don't cling to the old gods, accept zeus
pondering (in)equality, long rant
@amiloradovsky@functional.cafe seems like a answer to a very strange question to me, how does one arrive at that?
Obviously one should be paid for a service they provide, how does it matter how much they make, or how would you even know that?
In general I think wealth is a poor metric in isolation. It should be contrasted with expenditure, the quality of which becomes definitive. If someone accumulates twice the wealth you do in a month, but also spends that much in comparable period of time, then there is no accumulation to even speak of. We can only discuss throughput. Success and worthiness of a fresh water pipe going to a densely populated area is proportional to its throughput, while for another that's for some reason going into the ocean it is inverse.
Now since strictly defining (as a single number) what is necessary for survival and what is peak comfort is an impossible pipe dream of the control freak, I think we have to go with the greedy algorithm - wealth needs to be culturally devalued on its own, in favour of planned accumulation and expenditure.
People shouldn't be looking at one's net worth and thinking one successful and wondering whether one deserved it. They should be looking at one's expenses and laughing one out of the room for everything one wasted like an absolute moron and ginormous safety cushions one sits on like a total pussy.
This is not a novel idea and is common to a degree, but I think it should be strongly emphasised and applied more rigorously.
boring c++ porn
of course gcc 10.2 doesn't optimize my visit first anymore... it does if I inline it manually though... what is this regression? T_T
boring c++ porn
After this discussion with my arch-nemesis form functional.cafe, where I made some bold claims about what's possible in C, I went down the rabbit hole of tail/sibling calls.
Found a few discussions in compiler mailing lists, where the consensus seems to be that they are happy to add something explicit in the backend but not is C frontend, since it makes little sense there, so I decided to see how far can I push my idea and if it can be viable.
TLDR of my idea, if you want to jump into a procedure/function without storing the return address in the stack, just call it and if there is nothing to return to, nobody will be returning. The challenge is to make sure of this of course, without explicit syntax.
In C it isn't too difficult, as long as you stick to other well know functional programming good practices, (minimal mutability, maximal purity), you should be good to go. However it's otherwise a poor choice since it lacks necessary abstraction power to make this kind of technique viable. For example, to do anything remotely polymorphic, you would usually turn to type erasure and manual rtti, which will inevitably defeat the compiler.
C++ on the other hand seems more promising, there is a lot more you can do there at compile time, however ensuring that there is "nothing to return to" and the optimization will stick is harder. It's likely to be very unstable and finicky way to write code, but I find myself in pursuit of it anyway for some reason.
First thing I tried is to beef up my previous example with everyone's favourite these days - sum types (std::variant). Absolutely destroyed the optimization, calling into some random address, that wasn't even in code/text segment, labelled "...vtable...". The culprit was std::visit, which turns out does some form of type matching on steroids, to match/visit multiple variants at once, passing them to multi-parameter(what's the word I'm looking for?) function, I guess to be able to advertise it as a full-blown replacement for virtual member functions. Obviously the compiler would have a hard time seeing through all of that across translation units, so I had to write my own visit_first that would just match/visit one and forward the rest. That's the ugliest part of it all, but hey! it can go in the library (you are not a C++ programmer if you don't have a library :v).
Here is what I got so far:
https://git.sr.ht/~namark/funky/tree/5b10ed447cf6552710effbe1ed5fba17100239e6
I'm now tempted to write something a bit more realistic utilizing this technique, maybe a small game, so to be continued perhaps...
re: true co-routines in C