News for hackers. Stuff that matters.
Re:My personal C coding style as of late 2023 by guidoism on Sunday October 08, 2023 @11:25PM (#37816627)
I agree. A lot of languages have settled on those same names or something similar. We don’t live in a world with a single word size anymore so carrying bit length in the name is critical, and so is keeping identifier names short. His trade off is exactly the one I would make.
Re:My personal C coding style as of late 2023 by WalterBright on Monday October 09, 2023 @03:12AM (#37817836)
> carrying bit length in the name is critical

I beg to disagree. In D:

    byte - 8 bits
    short - 16 bits
    int - 32 bits
    long - 64 bits
absolutely nobody is confused about this.
Re:My personal C coding style as of late 2023 by iforgotpassword on Monday October 09, 2023 @03:29AM (#37817932)
Because we've used those names since forever, but that's archaic random crap really. Nothing apart from maybe "byte" makes sense here, the rest is completely arbitrary historic cruft. Could as well have called the rest timmy, britney and hulk.
Re:My personal C coding style as of late 2023 by runiq on Monday October 09, 2023 @04:13AM (#37818178)
> Nothing apart from maybe "byte" makes sense here

Lest we forget: https://web.archive.org/web/20170403130829/http://www.bobbem...

Re:My personal C coding style as of late 2023 by layer8 on Monday October 09, 2023 @04:21AM (#37818234)
Java uses exactly the same, and has a huge developer mindshare. While rooted in historic accidents, it's well-established.
Re:My personal C coding style as of late 2023 by another2another on Monday October 09, 2023 @04:14AM (#37818191)
In that case D should probably start to have an internal conversation about what they're going to call 128 bits then, 'cause its going to become a thing sooner or later.

stdint already has that covered though: (u)int128_t

Re:My personal C coding style as of late 2023 by gallier2 on Monday October 09, 2023 @05:05AM (#37818468)
it has defined the type for very long: it's cent and ucent. It hasn't implemented it completely though, but named and defined it is already forever.
Re:My personal C coding style as of late 2023 by fps_doug on Monday October 09, 2023 @06:28AM (#37818881)
So will the 256bit one be dollar or euro?
Re:My personal C coding style as of late 2023 by WalterBright on Monday October 09, 2023 @02:27PM (#37823525)
We'll think of something. Perhaps `bright`?
Re:My personal C coding style as of late 2023 by another2another on Monday October 09, 2023 @07:15AM (#37819147)
That's really interesting, and for me a totally unexpected name, having never seen that nomenclature before - would be interesting to see how consensus around that was arrived at - but hey, we gotta call it something! (But not DoubleQuadWord please ... )
Re:My personal C coding style as of late 2023 by gallier2 on Monday October 09, 2023 @05:08AM (#37818480)
and

    ubyte - 8 bits
    ushort - 16 bits
    uint - 32 bits
    ulong - 64 bits
    ucent - 128 bits
    
    float - 32 bits
    double - 64 bits
    real - maximum precision hardware allows (80 bits on x87).
Re:My personal C coding style as of late 2023 by eviks on Monday October 09, 2023 @05:46AM (#37818682)
Of course plenty of people are confused, the overhead of "short/long" just makes no sense, but yet another bad design from the past carefully preserved
Re:My personal C coding style as of late 2023 by WalterBright on Monday October 09, 2023 @02:20PM (#37823450)
Haven't run into a confused one yet, and D has been around 20 years.
Re:My personal C coding style as of late 2023 by eviks on Wednesday October 11, 2023 @09:13AM (#37843932)
That's just an indication of who you run into if you've missed people noticing/getting confused by this pretty obvious flaw
Re:My personal C coding style as of late 2023 by seanw444 on Monday October 09, 2023 @09:13AM (#37820132)
When we move into the 128-bit CPU era, will we call 128-bit integers "super long"? Maybe "elongated". Maybe "huge"?

Or, you know, we could just name them all by bit length and completely future-proof this system.

Re:My personal C coding style as of late 2023 by richard_todd on Monday October 09, 2023 @10:07AM (#37820594)
We used to call 16-bytes a paragraph, so the nostalgic geek in me would love to see ‘para’ catch on. I never thought I’d be slinging around whole paragraphs of memory in registers!
Re:My personal C coding style as of late 2023 by ogogmad on Monday October 09, 2023 @11:11AM (#37821270)
Why would we ever need 128-bit CPUs? I remember the PS2 had something like that (with details and caveats I don't understand), but subsequent games consoles went back to a more usual register size: https://en.wikipedia.org/wiki/128-bit_computing
Re:My personal C coding style as of late 2023 by seanw444 on Monday October 09, 2023 @11:49AM (#37821659)
All I know is we keep having this issue with saying "nah, this is it. Nobody will ever need more than this." And then inevitably the time comes when we need more.
Re:My personal C coding style as of late 2023 by WalterBright on Tuesday October 10, 2023 @01:09AM (#37828704)
Back in the 80s, 16 bit programmers knew that 32 bit code was coming, so they carefully crafted the code to be portable to 32 bits.

Of course, none of it worked on 32 bit machines because the programmers had never written 32 bit code before and did the portability measures all wrong.

Re:My personal C coding style as of late 2023 by WalterBright on Monday October 09, 2023 @02:20PM (#37823445)
We call them "cent" and "ucent" in D :-)
Re:My personal C coding style as of late 2023 by guidoism on Monday October 09, 2023 @07:23PM (#37826718)
Wait, isn't long 32 bits, long long is 64 bits.