Politicians only starts caring about peoples problems if they are either personally effected or one of their close friends/benefactors are effected.
99 karma · joined January 31, 2022
Politicians only starts caring about peoples problems if they are either personally effected or one of their close friends/benefactors are effected.
Vector* vector_create(size_t itemSize) {
Vector* vec = (Vector*)malloc(sizeof(Vector));
// ...
return vec;
}
This just immediately strike me as poor code.C is not java, you do not have to "new" up every little structure.
void vector_init(Vector *v, size_t itemSize) {
v->itemSize = itemSize;
// ...
}
Instantly cleaner, more efficient, less memory allocation/handling needed, lets the user control where the Vector is stored.Is the materials, exotic and rare stuff?
Do you need custom microchips/fabs or something?
Is it the engineer salaries, thousands of highly paid people times N years?
So why would you even be in a position to hire anyone?
In fact why are you working at all? The robots are doing everything already. Just sit back and relax, enjoy the matrix.
I've been using a simple unity-build ad-hoc build.bat/build.sh "system" for years now, works wonders.
YAGNI will serve you well, 99.99999(repeating)% of everyone's code will only be built and run on 1, maybe 2 platforms, why bother with these insane monstrosities that we call 'build systems"?
The few times I've needed to build for a new platform I just wrote that build script then and there, took a few minutes and that was it.
Modern machines can churn through a tens if not hundreds of K lines of C code in less than a second, so incremental builds aren't needed either (and if anything, with too many translation units you end up with linking being a bottleneck).
Single TU benefits:
- Global optimizations "for free".
- Make all functions static (except main) and you get --gc-sections "for free".
- Linking is blazingly fast.
- Don't have to bother with header files.
- No one has to download anything to built my code, I make it work on a default msvc/gcc/clang install (i.e if you have gcc, cl or clang in your path when running build.bat/build.sh, it will build).
The sane way to address that is to add explicit opt-in annotations like 'restrict'.
#push_optimize(assume_no_integer_overflow)
int x = a + b;
// more performance orientated code
#pop_optimize
// back to sane C
#push_optimize(assume_no_alias(a, b), assume_stride(a, 16), assume_stride(b, 16))
void compute(float *a, float *b, int index)
{
// here the compiler can assume a and b do not alias
// and it can assume it can always load 16 bytes at a time
// the programmer has made sure it's aligned and padded to so with any index
// there's always 16 bytes to load
// so go on, use any vectorized simd instruction you want
}
#pop_optimize
// back to sane CIf a branch is truly not supposed to ever happen, why have a branch at all? Just remove that code from the source entirely- that helps the optimizer even more, because the most optimal code is of course no code at all.
An unused variable means you weren't passing it on anywhere so there is no code which depends on its value, so how can it be a bug?
future = x.do_async(); return;
should not error out because of 'unused variable', it should give a error message concerning the lifetime of the future object.
By making text flow to 100% of the width you can easily resize the browser window for everyone's perfect reading width.
I usually run my browser tiled to 50% of the screen, the new design wastes a lot of space at that size (you have to shrink to really narrow width before it enters 'mobile mode' and uses 100% of the width again - I mean it's pretty insane, you can see more text at say 30% width, but at 40%-60% it pops out that useless white space padding on the left leading to a narrower effective text width)
>how do you know which call introduced the error first?
You rarely care about that but if you do you either make the error state stick to the first error, or as I said, make it a list you can append multiple errors to.
A sensible thing that often works great is to have a sticky error state (either a single int, or list of stuff you append to) then you just keep calling functions which will append to and/or replace the current error state until you reach a point where you can/care about handling errors, then you examine the persistent state and do something about it.
I do care about the size of a struct sometimes, but that would require me to go to the definition of the struct, so just seeing the word "struct" didn't help me one bit.
And I of course care about the members of the struct, but that again requires me to know what the actual members are which the word "struct" doesn't give me.
So what exactly does omitting the word "struct" hide again?
Hard disagree.
Life safer when dealing with things like SI unit types. I used to use lots of suffixes - _km, _m, _seconds, _hours, but I found that to be a lot more noisy (especially derived units and Nth order stuff like acceleration, seconds_per_second, etc) and evidently it would sneak in errors when you started doing calculations and passing them to functions.
Definitely want different types when I have these three representations flowing around in the program:
pressure_bits_t - raw data from the sensor, gets filtered/averaged in this form, then converted to one of these at various stages:
pressure_pascal_x10_t - integer pascal * 10 (i.e fixed point, one decimal)
pressure_millibar_t - floating point in millibar
What I want from a text editor is:
- Like you said, running tasks with a button/keybind, easily customizable (Like I wanna open a config file, add a function/script, bind to key/create UI button, done, not make a "plugin" not compile an "extension" or anything like that)
- Fuzzy finding/search - ripgrep and fzf can do that, so just bundle those I guess, or write my implementation of those.
- Must start instantly, load files instantly, every action needs to takes at most 100 ms.
- Be a "portable application", i.e it sits in a folder with everything it needs and I can copy that folder to any computer and be up and running with exactly the same configuration.
and NOTHING else.
It's an insult really, such incredible waste of all the potential processing power we all have.
I mean it does everything a printf() can do - except just better.
Because operators "should not be function calls"?
That would make zig unusable on soft float/soft div architectures, or would have to get rid of / for division and operators for floats.
But I would also assume add() is inlined and not be a function call in a sane language/compiler, so the explicitness even falls apart from the start.
I've found that to not matter that much these days - unless your projects is hundreds of thousands (or maybe millions even) of LOC, full builds are instant on modern machines.
Also anything mechanical is just way off on AI generated things - a car with the fuel door in the middle of the passenger door, a missing tire but you see no axle and nothing makes mechanical sense.
With non-power-2 bufsize you need some extra logic for write/readix++, but the rest of the code can stay the same.
Don't think I've ever constructed a more complicated type ('directly' so to speak, i.e without typedefs) than an array of function pointers (array of interrupt handlers, taking no arguments, returning void).
99.999(repeating)% of the time I use a typedef for function pointers and nothing looks particular complicated.
But it has built in flash.
Sure, external flash is still cheaper* (512K for ~$0.2) but it's a major downside having a mandatory extra chip because of how much more physical space it takes up.
* Might not actually be cheaper if you consider pick&place cost of an extra part you're not likely to use anywhere else.
I'm OK living in a world where elites might have higher risks of having their property rights violated during crisis times.
Don't download, install and run random code libraries from the internet, assume they are hostile until proven otherwise.
std::move_fast_and_break_things::vector
Or maybe the other way around so you can keep using std::vector: move_fast_and_break_things::std::vector
Then you can add a 'using namespace move_fast_and_break_things;' at the top of your files if you know you don't care about the ABI in your program.
I was assuming a dsl with kernel in rust.
I mean you can't even write an allocator in standard C.