I'm using large hexadecimal numbers in my programs and often waste time figuring out how many places the number is.
I know for base-10 numbers an easy way to grasp the size of the number is the multiply-by-1000 method:
// 15mhz clock
uint64_t clk_spd = 15 * 1000 * 1000;
But is there an easy separation method for hexadecimals? My question is effectively, instead of this:
// control register address
uint64_t reg_ctl_addr = 0x2400000000
Can I do something like this:
// control register address
uint64_t reg_ctl_addr = 0x24_0000_0000
I've tried underscores, commas, spaces, even /**/
between the groups of 0s, and nothing compiled.
Edit: I found this related question which is about decimal numbers, but it didn't compile for me:
% gcc numbers.c
numbers.c:6:16: error: expected ';' at end of declaration
long m = 24##0000UL;
^
;
1 error generated.