Deutsch   English   Français   Italiano  
<vt1a7f$i5jd$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.lang.c
Subject: Re: "A diagram of C23 basic types"
Date: Mon, 7 Apr 2025 21:49:02 +0200
Organization: A noiseless patient Spider
Lines: 70
Message-ID: <vt1a7f$i5jd$1@dont-email.me>
References: <87y0wjaysg.fsf@gmail.com> <vsj1m8$1f8h2$1@dont-email.me>
 <vsj2l9$1j0as$1@dont-email.me> <vsjef3$1u4nk$1@dont-email.me>
 <vsjg6t$20pdb$1@dont-email.me> <vsjgjn$1v1n4$1@dont-email.me>
 <vsjk4k$24q5m$1@dont-email.me> <vsjlcp$230a5$1@dont-email.me>
 <vsni1v$291i3$5@dont-email.me>
 <slrnvv82gk.2aciv.candycanearter07@candydeb.host.invalid>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 07 Apr 2025 21:49:07 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="cfb0029079a5771b7c280f12f406c134";
	logging-data="595565"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18zzxAENemI2xDJ9Yzk1I2m"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
Cancel-Lock: sha1:YzZ9Qp/OtUIY7+CTkwZ3HcmPrFs=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <slrnvv82gk.2aciv.candycanearter07@candydeb.host.invalid>
Bytes: 3997

On 07.04.2025 19:30, candycanearter07 wrote:
> 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?

Yes, where appropriate that's fine.

But that pattern doesn't work for numbers like 299792458 [m/s]
(i.e. in the general case, as opposed to primitive scalers).

And it's also not good for international languages (different
to US American and the like), where "billion" means something
else (namely 10^12, and not 10^9), so that its semantics isn't
unambiguously clear in the first place.

And sometimes you have large numeric literals and don't want
to add such CPP ballast just for readability; especially if
there is (or would be) a standard number grouping for literals
available.

So it's generally a gain to have a grouping syntax available.

> 
> 
> 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

That actually depends on what you do. Milliseconds was (for our
applications) often either not good enough a resolution, or, on
a larger scale, unnecessary or reducing the available range.

Quasi "norming" an integral value to represent a milliseconds unit
I consider especially bad, although not that bad as units of 0.01s
(that I think have met in Javascript). I also seem to recall that
MS DOS had such arbitrary sub-seconds units, but I'm not quite sure
about that any more.

A better unit is, IMO, a second resolution (which at least is a
basic physical unit) and a separate integer for sub-seconds. (An
older Unix I used supported the not uncommon nanoseconds attribute
but where only milli- and micro-seconds were uses, the rest was 0.)

Or have an abstraction layer that hides all implementation details
and don't have to care any more about implementation details of
such "time types".

> 
> 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

Janis