Destide@feddit.uk to Programmer Humor@lemmy.mlEnglish · 1 day agoInfallible Codeimagemessage-square150fedilinkarrow-up1444arrow-down125
arrow-up1419arrow-down1imageInfallible CodeDestide@feddit.uk to Programmer Humor@lemmy.mlEnglish · 1 day agomessage-square150fedilink
minus-squareCroquette@sh.itjust.workslinkfedilinkarrow-up2·14 hours agoI am a lazy dev (not really, clients always want fast code), so I use the provided HAL libraries 99.9% of the time. But I have seen code where someone would write something like gpio_write(PIN_X, true) and it always stood out to me.
minus-squareJackbyDev@programming.devlinkfedilinkEnglisharrow-up1·7 hours agoDefine on as true or something? Or maybe that’s more confusing. I’m not a C dev so I’m not gonna pretend to understand idiomatic microcontroller code lol.
minus-squareCroquette@sh.itjust.workslinkfedilinkarrow-up1·1 hour agoSometimes, people do that. But using 0/1 is explicit enough since you can refer to a line as ‘1’ or ‘0’ for high/low on the hardware as well
I am a lazy dev (not really, clients always want fast code), so I use the provided HAL libraries 99.9% of the time.
But I have seen code where someone would write something like
gpio_write(PIN_X, true)
and it always stood out to me.
Define on as true or something? Or maybe that’s more confusing. I’m not a C dev so I’m not gonna pretend to understand idiomatic microcontroller code lol.
Sometimes, people do that. But using 0/1 is explicit enough since you can refer to a line as ‘1’ or ‘0’ for high/low on the hardware as well