Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "c shenanigans"
-
hey devs, quick question:
does rust support branchless conditionnals and jump tables, and if yes where to look for syntax?
i found no example for branchless so far and jump tables are scary in rust (and i need a library to use them, it seems).
inb4 "why in the hell/ what possible use those have?!":
i use branchless to make a looping array and jump tables whenever there's more than 4 if statements with equal probability, and the deciding factor is a numeric value, so quite often.27 -
The crazy shenanigans you can do with C++ standard libs are fascinating.
Like implementig multithreading with just a foreach, and bindings which can make member function pointers to simple function pointers, and placeholders in bindings. Also lambda functions are cool.
Something between the lines:
my_crazy_class *tmp = new my_crazy_class(...);
std::vector<type> my_array = .....;
std::for_each(std::execution::par,my_array.begin(),my_array.end(),
[&](type in){
auto fn = std::bind( &my_crazy_class::my_crazy_fnc,*tmp,_1,random_static_value);
return fn(in);
});
ps:
It's pretty much pseudocode, and please don't do things like this, it's bad for your mental health.
pps:
I need to learn how to use this tools wisely. -
Our company (non tech) made Python available to install on company PCs sometime last year. Great! Only vanilla Python. Not so great. I opened a ticket to ask for the possibility to install additional packages, or if thats too much to ask, if they at least make some packages available (code review and somesuch was mentioned). Today (!), after several responsibility transfers, I finally had a conference call with someone in the company who
A) wanted to help me
B) was authorized to help me and
C) actually knew wtf I even wanted from them.
And after a goddamn hour of command line shenanigans and stackoverflow visits on both sides, I FINALLY have access to pipy.org and can download and install to my hearts content. However it was so long ago that I made that request that I kinda forgot what I wanted to actually DO with those packages...3