this post was submitted on 10 Aug 2025
149 points (95.7% liked)

Linux

8943 readers
826 users here now

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Zer0_F0x@lemmy.world 67 points 6 days ago (4 children)

I mean, he explained what and why is garbage and he's not wrong, so it's a valuable lesson at least.

[–] FizzyOrange@programming.dev 21 points 6 days ago (3 children)

Sort of. He's definitely right that make_u32_from_two_u16 is a terrible function name that obscures the meaning but I don't think he's right that the best solution is to inline it. C bit shifting is notoriously error prone - I've seen this bug multiple times:

uint32_t a = ...;
uint32_t b = ...;
uint64_t c = (a << 32) | b;

The real problem is the name isn't very good. E.g. it could be u32_high_low_to_u64 or something. Might clearer. Certainly easily at kernel code levels of clarity.

(Really the naming issue comes from C not having keyword arguments but you can't do anything about that.)

[–] wizzim@infosec.pub 2 points 5 days ago (2 children)

I am not a C developer, but I found the "helper has a terrible name" and "it's not clear what the helper is doing" arguments a bit weak.

Who in they right mind does not think the helper creates a 32 bytes word by putting the 16 bytes of the first argument followed by the 16 bytes of the second one ?

[–] traceur201@piefed.social 35 points 5 days ago

It's bits, not bytes. And endianness is a huge consideration in systems programming. And it's basically Linus' whole role at this point to enforce extreme consistency and standards since the project is so large with so many contributors

load more comments (1 replies)
load more comments (1 replies)
load more comments (1 replies)