« first day (3191 days earlier)      last day (1740 days later) » 

12:01 AM
Dammit, was gonna post this:
> Do you flip out like this when you fail a job interview or get fired? Some people don't take kindly to negative feedback. This is why security usually escorts the person out of the building when they are terminated. Same thing applies to SO.
> Like it or not, downvotes and close votes are a form of negative feedback to indicate that your content isn't up to par. Continued under-performance will result in termination. For most users, this is the question ban. Others prefer to flip out before that happens.
 
Are you trying to bait the guy? Thats oil for the fire. The guy has some wacky anti-authoritarian vision, and you're bringing up authority. His other social media accounts have Illuminati stuff.
 
@Mikhail yep!
 
12:30 AM
@Mikhail these types of people are incompetent he has nothing to fear from them.
 
user8104581
he has 38 answers and none got past 1 downvote
 
user8104581
though none got past 1 upvote either...
 
indifference usually is more of an insult.
A downvote to some degree shows that you care
 
user8104581
agreed
 
user8104581
though in his case I bet people that saw his answers likely just didn't think it was much special, informational or useful
 
12:45 AM
What's it the correlation between Twitter outages and crazy so questions?
 
@andreyrk if you were here for the "which is better for building a virus C/C++" question. You would have seen that guy get pummeled with downvotes. Because the question was effing hilarious. I remember someone wanting to keep it up for some reason.
 
@Rick There should be a close-lock on those just to see how low it can go.
 
1:01 AM
there really should, I would read through them just for the thrills.
 
user8104581
keeps people motivated for a few more days of answering i guess huh
 
and the comments are the best, "C++ standard library is the virus". That is forever lost.
 
He's not done yet:
-6
Q: It is under my dignity to get downvotes and closed for a VERY clear question

Pauli Sudarshan TerhoThe question was Is there a simple way to get a number from a string? It doesn't need to be fast or as complex as a hash or checksum algorithm, just a simple one-liner that give an integer that surely collide with another message but not within say 100 trials or so. put on hold as unclear wh...

 
lol
 
user8104581
did he really spend the last few hours complaining because he didn't put enough effort when asking a question
 
1:09 AM
yes
 
"You can still edit your question for clarity", lol trying to salvage a disaster.
 
i always find it funny when someone spends more effort defending themselves when told they didnt put effort in their question, than the actual effort in the questions
 
If you're bored and want some popcorn, tell the OP that. lol
 
awww deleted
 
1:26 AM
I don't know, the title "It is under my dignity to get downvotes and closed for a VERY clear question" <- you can't make this shit up. He is clearly upset, he is not used to receiving more than 1 down vote. It's below his dignity!
 
@Rick Yes, the math guys has all kinds of fancy names for this.
 
@CaptainGiraffe what are they? I've been having a hard time finding something that adequately explains the permutation space as a grid.
I feel like this is something no well-explored or explained.
 
1:41 AM
@Rick What do you want to understand?
 
-5
Q: AlexeiLevenkov misinterpreted and Rob closed down say it was my insult!

Pauli Sudarshan TerhoI said it need not to be a hash function and he said I said that must be a hash function. Who do you believe - me or the misinterpreter? Direct after Rob said that was me made an insult on the misinterpreter and closed the Meta post down. That should tell how crazy one must be to get such power...

 
I was talking to a math person yesterday, and they were able to see an intuitive answer to the solution I wanted but they were not able to adequately explain it.
one sec let pull out my example
@CaptainGiraffe we have two strings "abcdefgacb" "babcdefgac" where every swap is an edge
 
Rob
@Mysticial :(
 
@Rick You want a "distance"?
 
@CaptainGiraffe correct, but more specifically the shortest path
 
1:46 AM
@Rob suspended to cool down in 3, 2, 1...
 
or the min number of swaps
this is the solution
 
@Rick Yes, what you are looking for seems to me to be a sort. with a curious alphabet.
 
Rob
@Mysticial Leaving it for another mod to handle... so... we'll see :)
 
abcdefgacb babcdefgac
abcdefgacb abbcdefgac
abdefgacb abcdefgab
abdefgacb abdcefgab
abdefgacb abdecfgab
abdefgacb abdefcgab
abdefgacb abdefgcab
abdefgacb abdefgacb
 
haha
 
1:50 AM
@CaptainGiraffe I don't know if it can also be categorized as a sort. it is definitely a graph problem
 
Certain people in this lounge, or person shall I say, is like a layman, driving around the town, looking for car wrecks everyday. Then broadcast when he has found one.
 
but I'm not really in the solution as much as, the permutation grid is a space where the pattern is known but the nodes are not there. They are generated as needed
 
@Rick Ah, now I see. This is actually a classic, It's an exercise in TAOCP.
 
@CaptainGiraffe TAOCP?
 
2:01 AM
It probably does come from there, everything there relates to the question volume 4
that's a nice find
I'm just really interested in a description that describes the most direct path between these two strings.
just by looking at the problem we know that it's one that's bounded
a nieve first look tells us the upper bound is 10 swaps
and the lower bound 5
but there are perfect swaps which will narrow down our answer even more
there are 2 in the string I provided
but there is also a cycle d-> c, c-> a, a->g, g->f, f->e, e-> d
but the person could not formally explain to me why a cycle prevented any further narrowing of the upper bound. As a result of the cycle.
I feel like once I get that. I would have understood this problem in terms of the shortest path.
I don't know I just find this stuff cool.
Also the person I show this problem to got it in the first 1min of showing it to them. It took me a full day the optimal solution, still don't 100%, Really put me to shame.
 
2:26 AM
When the revolution comes we, also, kill all the smarter people
 
We should. Some people are too smart for their own good.
 
especially those smart pointers
 
Finally ordered my Amd threadripper CPU
 
Going to use it for anything fun?
 
Well if it can make work faster it will leave me more time doing other things
I feel still a bit bad the CPU alone is a expensive as a cheap computer
 
2:37 AM
How do you expect it to make work faster?
 
Less time waiting for something to build/etc so I don't get distracted waiting for tasks to complete
also SSD drives will certainly help
 
I got the same problem. I'm trying to spend my time working pen and paper architecture while stuff is compiling, but most of the time I'm so tired I'm just shit posting on here.
 
Sometimes restarting a server require updating all the modules that are installed to "reset" broken things... And I used to wait 30min for task to complete but when it fails 20min in the update and you only notice it 20min later... time adds up
 
> This account is temporarily suspended for rule violations. The suspension period ends on Jul 26 at 2:40.
"rule violations"? Not "to cool down"?
 
2:41 AM
what did he do?
 
@LoïcFaure-Lacroix Scroll up. He posted a shit-ton of meta posts with nothing but rants.
 
Rob
@Mysticial The notice depends on which canned message a moderator starts with
'rule violations' is usually a custom message from scratch
 
@Rob ah...
Definitely didn't know that. :)
 
He had a good run. Many laughs were had. Perhaps he will come to visit again.
 
He can probably come back with a different user name
 
2:48 AM
IP address is banned too i think
 
I live to believe a little part of the immortal lives in every shit poster
Curiously, he appeared to be Swedish, which is a slightly more civilized country of origin than the typical shit poster.
 
Unless his provider gives a static IP, you usually can disconnect your modem for a few minutes to force it to receive a new lease
 
Rob
@LoïcFaure-Lacroix We have some ways to check this. But if they manage to get around it, and then continue usage without causing any more issues which would get our attention, then mission accomplished
 
They could fingerprint his system via the browser, that's one way can't defeat the system without more effort than it would be ultimately worth.
 
@Rob as funny as it is, if you have more spammer than actual people and all spam bot rates any comment as constructive. Then the system is completely broken
 
2:55 AM
@LoïcFaure-Lacroix Byzantine fault tolerance.
But not with 2/3 since it's weighted in this case.
And all the bad actors would need to have enough rep to vote.
 
Yes except the xkcd just mention any user has to vote for any comment and comment themselves.
I guess limiting new users from voting would help thought.
 
3:17 AM
Also, I'm confused. Are calls to QMetaObject::invokeMethod with a Qt::QueuedConnection guaranteed to process items in the queue order? Or can the methods be invoked in any order?
 
 
5 hours later…
8:03 AM
what is the default difference_type for std::string::iterator?
 
my random guess would be ptrdiff_t
 
k
I wasn't sure if it doesn't use something like numbers but that prolly still makes sense
 
kzs
8:44 AM
hi guys
first time on c++chatroom
sorry for spamming, was overwhelmed to be here. ;)
 
kzs
9:03 AM
do we have partial include implementation in cpp pipeline,?
something like this in python.

from <lib1> import <utility1>.

to avoid footprint of libs.
 
@kzs nope
but there's not really any "overhead" at runtime here, since it's not dynamically done when executing
and depending on how you link unused functions will not be included in the final binary
 
kzs
oh i see,
I think unused functions are getting added , if i do readelf, function names are mangled,
let me check how to demangle and see the lib.

also i am using -fuse-ld=gold linker.
 
@kzs maybe try adding -flto to both compile and link
 
9:21 AM
linker will do dead code elimination
however it has to be conservative with that
 
kzs
9:32 AM
just tried the lto in compiler and linker, library size remained the same.

I am using 1 routine in the library, for my build,

if i didnt include that lib in my build, my lib size is 1mb otherwise 2.7mb.
:46746720
:46746630
and sorry for my poor english
 
@kzs but you didn't use -flto to cimpile the library you're linking against right?
oh and when you're compiling a library you might need to specify which functions you want to export, since there's no good concept of "unused" when compiling a library
 
Fun fact, in msvc thus works out of the box. So, it's not actually a hard problem.
 
yeah, the "export all" vs "export nothing" default approaches can differ.
 
10:04 AM
@BartekBanachewicz I've had the great fun of my first breakdown last night
seem like battery is fooked
 
@thecoshman ooh
@thecoshman what happened? Also I had another 3D breakdown last night
I don't think I want to do 3D graphics anymore
I read too many papers that are too hard and now I'm depressed again
 
I had gone out for ride after work, I usually wouldn't take it to work as it's so close. On my way back into town, I was right by my office, and it just spluttered out on me, and woudn't start up again.
I tried waiting a bit to try again, but nope
This morning a friend bump started it, a skill I need to learn :P
but yeah, got to try sort out battery
 
@thecoshman That can be dangerous
@thecoshman that's not necesarily the battery
 
thing is, as I was riding for like an hour before, the battery shouldn't be flat
 
10:09 AM
so either it's just not able to hold a charge any more, or it's not being charged from the engine
 
did you measure the voltages while running and not running?
 
This was only last night
Same friend has a battery charger/conditioner yoke
 
that doesn't answer my question
 
No... as it was only last night it happened
 
well that'd be the first thing to do
also investing in a cheap multimeter might be a good idea
something you can either carry around or just a one with LCD to hook up to the bike permanently
 
10:11 AM
There's many cheapo voltagemeter modules out there complete with displays
 
@thecoshman Does the bike have a battery light? Did it light up at any point during the ride?
 
Fairly sure there isn't a battery light... if there is one, it didn't come on
I have a normal multimeter
but I don't want to be lugging a half a garage of tools with me all the time :P
But I do like the idea of adding a gauge :P
 
 
2 hours later…
12:14 PM
so C++ bois
is there a reasonable way to mark getters noexcept
if they're reference it's "always"
if they're by value it depends on the ctor of the returned type
 
12:35 PM
@BartekBanachewicz SFINAE IIRC
something like auto foo() -> T noexcept(std::is_nothrow_move_constructible_v<T>) I would think
if you're returning a copy std::is_nothrow_copy_constructible
 
1:39 PM
If I cast a char * to a size_t and that returns something like 0x7, does that mean that the length of char * is too big to be represented by size_t?
 
@DemCodeLines no it means you're doing something odd. Without seeing what you're doing I can't say. Either way that's technically UB. Pointers can reasonably only be cast to std::intptr_t and std:uintptr_t
 
 
1 hour later…
kzs
2:53 PM
I did used -flto for compiling as well linking,
ok, now your explanation makes it more clearer to me,
extern did helped.
I didn't thought about it. Thanks a lot!
Sorry , I was out for a while and just came to desk,
 
3:22 PM
 
 
2 hours later…
@Mysticial and that's how I learned Linux
 
5:26 PM
@Mgetz By getting kicked off a branch?
 
By using gentoo... worse: doing it on an intel Atom
 
ooooh
 
Yeah one of the early 64bit atom boards
 
I would have expected you to learn linux before Intel atom
 
@Mgetz I wonder how the cartoonist would depict Slackware 1.0...
 
5:32 PM
Homeless man with a pipe eats the baby bird
 
or linux from scratch
 
Or some corporate Linux distro
Should I use a recursive mutex to make it easier to copy and paste code without thinking?
 
5:50 PM
@Mikhail Copying code without thinking is the best way to get bugs
So no
 
On the other hand, forgetting to mark something as requiring thread safety is a good way to get bugs. I'm almost thinking of doing something like std::atomic<std::vector<T>>
Ah, now I remember how this junk is supposed to work. You can store the protected data inside a structure and access it with a functor .
struct
{
void get_data(std::function<void(Data&)> data_getter);
private:
std::mutex m;
Data m_data;
}
 
I just use immutable stuff all the time in my multithreaded code.
Who needs locking when nothing changes?
 
deep copies
I never quiet understood the implementation and times involved in locking an std::recursive_mutex. For example, which is longer, time to lock the mutex if the thread already holds the mutex, or if the thread doesn't already hold the mutex (but no contention)
 
6:07 PM
recursive_mutex can be implemented fairly efficiently with a counter and a thread ID #.
Overhead of acquiring it if you already have it is just a branch and a couple load/stores.
Acquiring it when it's unlocked will be a compare-exchange and a couple load/stores.
Releasing it will be expensive if something is waiting on it.
 
@Mikhail does this inversion really give you anything? anybody can choose to keep the reference around, well outside the synchronisation
 
@LucDanton But its much harder, you'd have to store the reference which requires effort
 
@Mysticial In my measurements some years ago the cost of mutex lock + unlock was around 30ns (no contention). Which is kinda slow considering how few instructions are needed.
Maybe the fact that it's a non-inline function call to a shared library (position independent code) plays a role in this.
 
@StackedCrooked If unlock bypasses the kernel, then there has to be a flag on the mutex that indicates whether something is waiting.
So the lock would have two fields: A thread ID #, and a bool indicating if anything is waiting.
 
Ok. But that doesn't really explain the 30ns, does it?
 
6:16 PM
Acquiring an unlocked lock means load+cmpxchg the thread # to yourself. That's easily a dozen ns.
Releasing a lock with nothing waiting on it would require reading the wait flag to see if anyone is waiting. Then zeroing the thread ID. No lock instructions needed.
Yeah, that shouldn't require 30ns.
If the lock is in the L1 cache.
 
Maybe I should check again. Because my malloc benchmark also resulted in 30ns. Something about 30ns.
 
Acquiring a locked lock will see a non-zero thread #. Then it needs to call into the OS to register the lock address and the current thread as a waiter and to deschedule.
Releasing a lock with waiters will see the flag and call into the OS to signal a waiter.
 
Yeah. I get that part.
 
But that's just my assumption of a trivial lock with only two fields.
The actual implementation of std::mutex could be worse. Since I haven't though about what would be needed to make condition variables work.
 
Funny how mutex and condition_variable seem to be designed for single CPU concurrency. If you notify a condition variable then the other thread wakes up, takes the lock, and does its work. If you call notify_all this is repeated for waiting threads. This totally disables parallelism (since only one can have the mutex).
Meanwhile spinlock can't work on a single core system.
 
6:21 PM
@StackedCrooked I think in actual uses cases of notify_all the threads are just waiting for a barrier before they continue.
So they'll wake up holding the lock and then immediately release it to continue.
But yes, still serialization involved.
 
@Mysticial L1 cache of the currently-owning thread...
 
Folly has a LifoSem. A semaphore that enables waking up multiple threads with a single post. It seems useful.
 
@StackedCrooked 30 ns is the new six to eight weeks!
 
@StackedCrooked Or go lockless. Have them all spin on single flag.
 
@StackedCrooked Sounds quite a bit like a counted semaphore (except that it probably wakes N separate threads, where a counted semaphore just does N thread-wake events, but might wake fewer threads more times).
 
6:25 PM
@Mysticial I do use a spinlock in the performance critical code at work.
Actually, I have a Mutex typedef that resolves to std::mutex or my SpinLock depending to the target system. The old systems that don't have enough cores need to use std::mutex (otherwise all hell breaks lose.)
 
typedef that resolves to std::mutex or my SpinLock depending to the target system
^ ಠ_ಠ
 
eww... Don't that.
Use using instead. :D:D:D
2
 
@Mysticial You actually made me check the code.
It's actually using using.
 
awwww
 
I know. I'm good :)
 
6:31 PM
@StackedCrooked Does tend to be a problem if all the cores are sitting in spin-locks (unless they're waiting on an event from external hardware).
 
dear god there is a 10 degree C difference across my ram sticks
 
Still, I suspect a lot of people would be rather surprised at how much spin locks get used in device drivers...
 
@Mgetz Air flow not getting to the ones in the middle?
 
@Mysticial so the ordering from closest to the fans to the CPU is 2 1 4 3
the difference between 2 and 3 is 10C easily
 
@EtiennedeMartel I dont remember the last time I ran into non-trivial multithread code that wasnt mutating at least some state
 
6:33 PM
@Mysticial Suddenly, I see a new market for matched sets of RAM sticks, with heat sinks of graduated heights.
 
I probably should pull sticks 1 and 3
I don't really need 32GB of ram
 
@Borgleader I usually use the file system, or concurrent collections, or sometimes even locks, but those are rare.
 
@Borgleader You're clearly a mutant.
 
Most of my state is immutable, which means a lot of bugs just can't happen.
 
@JerryCoffin hmm.....
 
6:34 PM
@JerryCoffin There was one OEM claiming to watercool them...
but honestly the issue is more that I have four sticks, in a warm corner... in a case that could have better airflow
so they were getting up to 54C
which is waaay too warm for RAM
 
@EtiennedeMartel When I first started teaching myself multi-threading back in like 2008-ish, I noticed that the memory allocator wasn't thread-safe. So rather than trying to fix that, I totally did the obviously thing which was to eliminate all memory allocations and do static partitioning.
 
I have a char ** variable (called set) and another char * which points to an element inside set. I am trying to get the index of this variable but can’t seem to find it. Assuming that “*k” holds the pointer to the element, I did *k - *set, but that gave me a weird number like 399933, whereas the array itself can only hold 16 elements
Am I doing something wrong here?
 
@Mysticial Oh, I mostly work in C#, I don't have to mess around with allocators ;)
 
Complicated and buggy as fuck. But it resulted in full program determinism provided that any bugs didn't spill into another thread.
 
@Mysticial pretty much what most games do
 
6:36 PM
@JerryCoffin The many-core systems that use SpinLock have all threads pinned to their own dedicated core. There's a single RPC thread and multiple "work threads". Each work thread has it's own state that is only shared with the RPC thread. So contention is always between the single RPC thread and one of the work threads. It works reasonably well. But actually no, it sucks, because RPC thread can be slow and block the work threads. I suck.
I need to rewrite it.
 
So re-architecting the entire program instead of setting the right compiler flag was a blessing in disguise as since it turns out later that eliminating allocations was necessary anyway in the long run.
And it eliminated nearly all heisenbugs.
 
@StackedCrooked So this is why MS has SLIST in the kernel, basically it's an atomic singly linked list... you basically take work off the top and exchange the next item in the same go. If the exchange fails you try again on the next item
each thread cares about a lot less then and you can use fibers
 
@Mgetz Not sure how that relates to what I said. ... But yeah. I suppose it would be better if the RPC thread posted tasks on the worker thread's queue. This would avoid the blocking.
 
Anyone?
 
@StackedCrooked depends on how you are managing work, generally there are two ways to look at it. You can fiber/threadpool or you can dispatch
With the former then each thread eagerly tries to grab work, but also has a 'sleeping fibers' list that it checks for IO results before doing so
with the latter you tend to have a global scheduler lock
it's worth noting that Spinlocks and the former don't get along at all
as it prevents the thread from 'sleeping' the fiber
@DemCodeLines No idea what you're doing so I can't comment, but subtracting pointers not pointing to the same memory is UB last I checked
 
6:47 PM
@Mgetz Fiber is good if you want multiple workers on a single core without the context switching overhead of native threads. However, in my case all workers are pinned to their own single dedicated core. (And the program only works if there's enough cores. Otherwise it quits.)
 
@StackedCrooked fibers are good for a lot of things, not just that. If you look at most new threading libs they are basically fiber/threadpool based. Where instead of using a lock you just queue a job on a specific thread
 
@Mgetz Sure.
 
Obviously I have no idea how you're doing your tasking
 
@Mgetz Is UB undefined behavior? I have an array of items and a pointer which points to one of the elements in that array. I’m just trying to calculate the index of this element in the array.
 
did you allocate all the arrays in the array of arrays with one allocation?
if no then it's UB
 
6:55 PM
@DemCodeLines I think you need *k - set (instead of *k - *set.)
 
*k = (Item *)
*set = (Set *)
That’s how my variables are laid out. *k points to some element inside set
 
I'm having a hard time understanding this from snippets, do you mean something like this: ideone.com/2HayKc ?
 
Basically, I am building a Set structure and stuck on trying to figure out the index of an element when I add it to the Set. When I add an item to the Set, it goes in one of the buckets or creates a new one based on its hash. But I am trying trying to figure out how to get the index of that element without having to traverse all the elements every time I add a new element.
Assuming that *k is a pointer to a newly added item, I’m trying to figure out it’s position in the Set
 
right, but presumably each bucket was allocated independently right?
 
@DemCodeLines This is very basic stuff. The way to get the index of an array element is to subtract the address of the element with the address of the first element of the array.
 
7:06 PM
Yes, the Set structure is something like “typeset struct { Bucket **buckets; ... } Set. When adding to the set, I calloc space for a new Bucket.
@StackedCrooked that returns to me a very large number which is out of range
 
@DemCodeLines You're probably comparing the value of the element with the address of the array.
Anyway. It's easier if you use a typedef on the element type. For example: using Element = char*; Then you can declare the array as Element my_array[100]. This makes the array arithmetic more intuitive because you remove the double pointers (char**).
@DemCodeLines Or you have a copy of the value and you compare the address of the copy to the address of the first element in the array.
I bet that's the issue.
 
8:11 PM
@Borgleader
11
Q: Can Stack Overflow do any more to promote the asking of better questions by new users?

JohnI know a new flow for new users asking questions was put in place, but unfortunately that seems to be disregarded by some users. Take this question, for example. It was asked under the C# tag within the last hour or so. The title is simply the error message, as is the question body. It's a gen...

^^ hahaha
 
That's a new low level of effort, it seems.
 
it seems like trolling.
 
user8104581
8:33 PM
 
user8104581
guy must have been struggling for a while huh
 
ahahaha
 
 
3 hours later…
11:11 PM
Its 6:00 pm and I can't get out of the orifice. Sad part is that I'd just go code somewhere else.
 

« first day (3191 days earlier)      last day (1740 days later) »