Sujet : Re: "A diagram of C23 basic types"
De : candycanearter07 (at) *nospam* candycanearter07.nomail.afraid (candycanearter07)
Groupes : comp.lang.cDate : 07. Apr 2025, 18:30:03
Autres entêtes
Organisation : the-candyden-of-code
Message-ID : <slrnvv82gk.2aciv.candycanearter07@candydeb.host.invalid>
References : 1 2 3 4 5 6 7 8 9
User-Agent : slrn/1.0.3 (Linux)
Lawrence D'Oliveiro <
ldo@nz.invalid> wrote at 03:01 this Friday (GMT):
On Wed, 2 Apr 2025 16:33:46 +0100, bart wrote:
>
Here, tell me at a glance the magnitude of
this number:
10000000000
>
#define THOUSAND 1000
#define MILLION (THOUSAND * THOUSAND)
#define BILLION (THOUSAND * MILLION)
>
uint64 num = 10 * BILLION;
>
Much easier to figure out, don’t you think?
I used to do a bit of code for a codebase that did that with SECONDS and
MINUTES since (almost) every "time" variable was in milliseconds, and it
was very nice. That is just my subjective opinion, though. :P
it was more like
#define SECONDS *10
#define MINUTES SECONDS*60
#define HOURS MINUTES*60
, though. Probably would be more notably annoying to debug in weird
cases if the whole language/codebase wasnt borked spagetti :D
-- user <candycane> is generated from /dev/urandom