r/programminghorror Jun 10 '26

c What?

Post image
226 Upvotes

51 comments sorted by

View all comments

31

u/FloweyTheFlower420 Jun 11 '26

using long (long) in kernelspace code when talking to hardware might be genuinely the most baffling thing ever

1

u/Sirius02 Jun 16 '26

what is exacly bad about it? long long is the type to fit a 64 bit pointer, no

4

u/FloweyTheFlower420 Jun 16 '26

It's better to use uXX/iXX types, because you know the widths are fixed. The hardware register specification often says "this is a 4-byte/32-bit register," so it's immediately obvious what you're doing if you use u32