|
|
|
|
|
by properparity
1256 days ago
|
|
>even BIGGER no. This is completely misunderstanding what a typedef is and what it should be used for. Hard disagree. Life safer when dealing with things like SI unit types. I used to use lots of suffixes - _km, _m, _seconds, _hours, but I found that to be a lot more noisy (especially derived units and Nth order stuff like acceleration, seconds_per_second, etc) and evidently it would sneak in errors when you started doing calculations and passing them to functions. Definitely want different types when I have these three representations flowing around in the program: pressure_bits_t - raw data from the sensor, gets filtered/averaged in this form, then converted to one of these at various stages: pressure_pascal_x10_t - integer pascal * 10 (i.e fixed point, one decimal) pressure_millibar_t - floating point in millibar |
|