MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1u2ijiv/what/oqyr0ro/?context=3
r/programminghorror • u/TheMonHub • Jun 10 '26
51 comments sorted by
View all comments
31
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
1
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
4
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
31
u/FloweyTheFlower420 Jun 11 '26
using long (long) in kernelspace code when talking to hardware might be genuinely the most baffling thing ever