99 karma · joined Jun 15, 2018 (8y ago) · 38 submissions
comment 3y ago · link · parent
Then you can have explicit functions for the operation you want: signed_mul(), signed_less_than(), unsigned_greater_than(), add_assume_no_overflow(), etc. (add your favorite syntactic sugar/operator symbols for these).
Assembly is more explicit and clearer to understand in this regard.
comment 3y ago · link · parent
Is there an example of a program that was crap, implemented telemetry and then got better afterwards? (and of course controlled for factors that might have improved the program anyway)
I mean since telemetry advocates are so into how useful data is, surely they must have data on whether telemetry itself works?
comment 3y ago · link · parent
So to me when trying to measure anything it seems so blatantly obvious that it has to change the outcome - you will interact in some way with the system to get any information out, and this will change the tracejctory, energy, momentum or whatever of the particles.
I mean is that it? That's the mystery?
comment 3y ago · link · parent
Unless someone finds a way of scaling up production and/or reducing the cost, you're not gonna see organs popping up everywhere, hence limited access.
comment 3y ago · link · parent
Only ISO C can reserve things, no one else, and ISO C does not reserve the _t suffix.
comment 3y ago · link · parent
A big downside is that you you can't easily take ownership of an existing buffer and treat it as this string type.
string s;
char some_buf[];
string_take(&s, some_buf, some_capacity);
Also you would of course never dynamically allocate string structs, just the data member if needed.
comment 4y ago · link · parent
Unfortunately consoles have become normal PCs in this regard - if you wanna play online you'll be forced to update the console OS and applyvgame patches.
comment 4y ago · link · parent
You can use the entire buffer and not waste one slot by doing:
push: buf[writeidx % bufsize] = x;
writeidx++;
pop: x = buf[readidx % bufsize];
readidx++;
Unsigned integers, you get size by doing: writeidx - readidx; Then you check size==0 or size==bufsize to detect empty/full.
comment 4y ago · link · parent
No allocation = no leaks, no use after free, no dangling pointers.
No multi core = no atomics or concurrency to worry about.
Ring buffers solve 99% of my interrupt data sharing = no need to worry about synchronization.
Bounds/safety checks? Need to run and test release builds most of the time because of space/memory constraints.