Most active commenters
  • epcoa(5)
  • __turbobrew__(3)

←back to thread

288 points Twirrim | 33 comments | | HN request time: 2.134s | source | bottom
1. harry8 ◴[] No.41874909[source]
Is C++ capable of deprecating or simplifying anything?

Honest question, haven't followed closely. rand() is broken,I;m told unfixable and last I heard still wasn't deprecated.

Is this proposal a test? "Can we even drop support for a solution to a problem literally nobody has?"

replies(12): >>41875009 #>>41875032 #>>41875407 #>>41875528 #>>41875757 #>>41875887 #>>41876970 #>>41877466 #>>41877729 #>>41877980 #>>41878258 #>>41878901 #
2. epcoa ◴[] No.41875009[source]
Signed integers did not have to be 2’s complement, there were 3 valid representations: signed mag, 1s and 2s complement. Modern C and C++ dropped this and mandate 2s complement (“as if” but that distinction is moot here, you can do the same for CHAR_BIT). So there is certainly precedence for this sort of thing.
3. nialv7 ◴[] No.41875032[source]
well they managed to get two's complement requirement into C++20. there is always hope.
replies(1): >>41875491 #
4. hyperhello ◴[] No.41875407[source]
C++ long ago crossed the line where making any change is more work than any benefit it could ever create.
replies(2): >>41877472 #>>41877778 #
5. oefrha ◴[] No.41875491[source]
Well then someone somewhere with some mainframe got so angry they decided to write a manifesto to condemn kids these days and announced a fork of Qt because Qt committed the cardinal sin of adopting C++20. So don’t say “a problem literally nobody has”, someone always has a use case; although at some point it’s okay to make a decision to ignore them.

https://lscs-software.com/LsCs-Manifesto.html

https://news.ycombinator.com/item?id=41614949

Edit: Fixed typo pointed out by child.

replies(3): >>41875583 #>>41875873 #>>41876055 #
6. mrpippy ◴[] No.41875528[source]
C++17 removed trigraphs
replies(1): >>41875630 #
7. ripe ◴[] No.41875583{3}[source]
> because Qt committed the carnal sin of adopting C++20

I do believe you meant to write "cardinal sin," good sir. Unless Qt has not only become sentient but also corporeal when I wasn't looking and gotten close and personal with the C++ standard...

8. poincaredisk ◴[] No.41875630[source]
Which was quite controversial. Imagine that.
9. Nevermark ◴[] No.41875757[source]
I think you are right. Absolutely.

Don’t break perfection!! Just accumulate more perfection.

What we need is a new C++ symbol that reliably references eight bit bytes, without breaking compatibility, or wasting annnnnny opportunity to expand the kitchen sink once again.

I propose “unsigned byte8” and (2’s complement) “signed byte8”. And “byte8” with undefined sign behavior because we can always use some more spice.

“unsigned decimal byte8” and “signed decimal byte8”, would limit legal values to 0 to 10 and -10 to +10.

For the damn accountants.

“unsigned centimal byte8” and “signed centimal byte8”, would limit legal values to 0 to 100 and -100 to +100.

For the damn accountants who care about the cost of bytes.

Also for a statistically almost valid, good enough for your customer’s alpha, data type for “age” fields in databases.

And “float byte8” obviously.

replies(1): >>41876095 #
10. epcoa ◴[] No.41875873{3}[source]
Wow.

https://theminimumyouneedtoknow.com/

https://lscs-software.com/LsCs-Roadmap.html

"Many of us got our first exposure to Qt on OS/2 in or around 1987."

Uh huh.

> someone always has a use case;

No he doesn't. He's just unhinged. The machines this dude bitches about don't even have a modern C++ compiler nor do they support any kind of display system relevant to Qt. They're never going to be a target for Qt. Further irony is this dude proudly proclaims this fork will support nothing but Wayland and Vulkan on Linux.

"the smaller processors like those in sensors, are 1's complement for a reason."

The "reason" is never explained.

"Why? Because nothing is faster when it comes to straight addition and subtraction of financial values in scaled integers. (Possibly packed decimal too, but uncertain on that.)"

Is this a justification for using Unisys mainframes, or is the implication that they are fastest because of 1's complement? (not that this is even close to being true - as any dinosaurs are decomissioned they're fucking replaced with capable but not TOL commodity Xeon CPU based hardware running emulation, I don't think Unisys makes any non x86 hardware anymore) Anyway, may need to refresh that CS education.

There's some rambling about the justification being data conversion, but what serialization protocols mandate 1's complement anyway, and if those exist someone has already implemented 2's complement supporting libraries for the past 50 years since that has been the overwhelming status quo. We somehow manage to deal with endianness and decimal conversions as well.

"Passing 2's complement data to backend systems or front end sensors expecting 1's complement causes catastrophes."

99.999% of every system MIPS, ARM, x86, Power, etc for the last 40 years uses 2's complement, so this has been the normal state of the world since forever.

Also the enterpriseist of languages, Java somehow has survived mandating 2's complement.

This is all very unhinged.

I'm not holding my breath to see this ancient Qt fork fully converted to "modified" Barr spec but that will be a hoot.

replies(1): >>41876530 #
11. jfbastien ◴[] No.41875887[source]
As mentioned by others, we've dropped trigraph and deprecated rand (and offer an alternative). I also have:

* p2809 Trivial infinite loops are not Undefined Behavior * p1152 Deprecating volatile * p0907 Signed Integers are Two's Complement * p2723 Zero-initialize objects of automatic storage duration * p2186 Removing Garbage Collection Support

So it is possible to change things!

12. __turbobrew__ ◴[] No.41876055{3}[source]
This person is unhinged.

> It's a desktop on a Linux distro meant to create devices to better/save lives.

If you are creating life critical medical devices you should not be using linux.

replies(1): >>41876446 #
13. bastawhiz ◴[] No.41876095[source]
> For the damn accountants who care about the cost of bytes.

Finally! A language that can calculate my S3 bill

14. smaudet ◴[] No.41876446{4}[source]
> If you are creating life critical medical devices you should not be using linux.

Hmm, what do you mean?

Like, no you should not adopt some buggy or untested distro, instead choose each component carefully and disable all un-needed updates...

But that beats working on an unstable, randomly and capriciously deprecated and broken OS (windows/mac over the years), that you can perform zero practical review, casual or otherwise, legal or otherwise, and that insists upon updating and further breaking itself at regular intervals...

Unless you mean to talk maybe about some microkernel with a very simple graphical UI, which, sure yes, much less complexity...

replies(1): >>41876522 #
15. __turbobrew__ ◴[] No.41876522{5}[source]
I mean you should be building life critical medical devices on top of an operating system like QNX or vxworks which are much more stable and simpler.
replies(1): >>41880587 #
16. smaudet ◴[] No.41876530{4}[source]
Yeah, I think many of their arguments are not quite up to snuff. I would be quite interested how 1s compliment is faster, it is simpler and thus the hardware could be faster, iff you figure out how to deal with the drawbacks like -0 vs +0 (you could do it in hardware pretty easily...)

Buuuut then the Unisys thing. Like you say they dont make processors (for the market) and themselves just use Intel now...and even if they make some special secret processors I don't think the IRS is using top secret processors to crunch our taxes, even in the hundreds of millions of record realm with average hundreds of items per record, modern CPUs run at billions of ops per second...so I suspect we are talking some tens of seconds, and some modest amount of RAM (for a server).

The one point he does have is interoperability, which if a lot of (especially medical) equipment uses 1s compliment because its cheaper (in terms of silicon), using "modern" tools is likely to be a bad fit.

Compatability is King, and where medical devices are concerned I would be inclined to agree that not changing things is better than "upgrading" - its all well and good to have two systems until a crisis hits and some doctor plus the wrong sensor into the wrong device...

replies(2): >>41876811 #>>41886407 #
17. epcoa ◴[] No.41876811{5}[source]
> The one point he does have is interoperability, which if a lot of (especially medical) equipment uses 1s compliment

No it’s completely loony. Note that even the devices he claims to work with for medical devices are off the shelf ARM processors (ie what everybody uses). No commonly used commodity processors for embedded have used 1’s complement in the last 50 years.

> equipment uses 1s compliment because its cheaper (in terms of silicon)

Yeah that makes no sense. If you need an ALU at all, 2s complement requires no more silicon and is simpler to work with. That’s why it was recommended by von Neumann in 1945. 1s complement is only simpler if you don’t have an adder of any kind, which is then not a CPU, certainly not a C/C++ target.

Even the shittiest low end PIC microcontroller from the 70s uses 2s complement.

It is possible that a sensing device with no microprocessor or computation of any kind (ie a bare ADC) may generate values in sign-mag or 1s complement (and it’s usually the former, again how stupid this is) - but this has nothing to do with the C implementation of whatever host connects to it which is certainly 2s. I guarantee you no embedded processor this dude ever worked with in the medical industry used anything other than 2s complement - you would have always needed to do a conversion.

This truly is one of the most absurd issues to get wrapped up on. It might be dementia, sadly.

https://github.com/RolandHughes/ls-cs/blob/master/README.md

Maintaining a fork of a large C++ framework (well of another obscure fork) where the top most selling point is a fixation on avoiding C++20 all because they dropped support for integer representations that have no extant hardware with recent C++ compilers - and any theoretical hardware wouldn’t run this framework anyway, that doesn’t seem well attached to reality.

18. mort96 ◴[] No.41876970[source]
How is rand() broken? It seems to produce random-ish values, which is what it's for. It obviously doesn't produce cryptographically secure random values, but that's expected (and reflects other languages' equivalent functions). For a decently random integer that's quick to compute, rand() works just fine.
replies(2): >>41878937 #>>41880390 #
19. pjmlp ◴[] No.41877466[source]
GC API from C++11 was removed in C++23, understandibly so, given that it wasn't designed taking into account the needs of Unreal C++ and C++/CLI, the only two major variants that have GC support.

Exception specifications have been removed, although some want them back for value type exceptions, if that ever happens.

auto_ptr has been removed, given its broken design.

Now on the simplying side, not really, as the old ways still need to be understood.

20. pjmlp ◴[] No.41877472[source]
It is one of my favourite languages, but I think it has already crossed over the complexity threshold PL/I was known for.
21. BoringTimesGang ◴[] No.41877729[source]
>haven't followed closely

Don't worry, most people complaining about C++ complexity don't.

replies(1): >>41930278 #
22. BoringTimesGang ◴[] No.41877778[source]
This is such an odd thing to read & compare to how eager my colleagues are to upgrade the compiler to take advantage of new features. There's so much less need to specify types in situations where the information is implicitly available after C++ 20/17. So many boost libraries have been replaced by superior std versions.

And this has happened again and again on this enormous codebase that started before it was even called 'C++'.

23. 112233 ◴[] No.41877980[source]
they do it left and right when it meets their fancy, otherwise it is unconscionable.

Like making over "auto". Or adding "start_lifetime_as" and declaring most existing code that uses mmap non-conformant.

But then someone asks for a thing that would require to stop pretending that C++ can be parsed top down in a single pass. Immediate rejection!

24. rty32 ◴[] No.41878258[source]
One obvious example is auto_ptr. And from what I can see it is quite successful -- in a well maintained C++ codebase using C++ 11 or later, you just don't see auto_ptr in the code.
25. ◴[] No.41878901[source]
26. akdev1l ◴[] No.41878937[source]
> The function rand() is not reentrant or thread-safe, since it uses hidden state that is modified on each call.

It cannot be called safely from a multi-threaded application for one

27. tntxtnt ◴[] No.41880390[source]
RAND_MAX is only guaranteed to be at least 32767. So if you use `rand() % 10000` you'll have real biased towards 0-2767, even `rand() % 1000` is already not uniform (biased towards 0-767). And that assumes rand() is good uniform from 0-RAND_MAX in the first place.
28. epcoa ◴[] No.41880587{6}[source]
Regulations are complex, but not every medical device or part of it is "life critical". There are plenty of regulated medical devices floating around running Linux, often based on Yocto. There is some debate in the industry about the particulars of this SOUP (software of unknown provenance) in general, but the mere idea of Linux in a medical device is old news and isn't crackpot or anything.

The goal for this guy seems to be a Linux distro primarily to serve as a reproducible dev environment that must include his own in-progress EDT editor clone, but can include others as long as they're not vim or use Qt. Ironically Qt closed-source targets vxWorks and QNX. Dräger ventilators use it for their frontend.

https://www.logikalsolutions.com/wordpress/information-techn...

Like the general idea of a medical device linux distros (for both dev host and targets) is not a bad one. But the thinking and execution in this case is totally derailed due to outsized and unfocused reactions to details that don't matter (ancient IRS tax computers), QtQuick having some growing pains over a decade ago, personal hatred of vim, conflating a hatred of Agile with CI/CD.

replies(1): >>41885816 #
29. __turbobrew__ ◴[] No.41885816{7}[source]
> You can't use non-typesafe junk when lives are on the line.

Their words, not mine. If lives are on the line you probably shouldn’t be using linux in your medical device. And I hope my life never depends on a medical device running linux.

replies(1): >>41888570 #
30. Dagonfly ◴[] No.41886407{5}[source]
> it is simpler and thus the hardware could be faster

Is it though? With twos compliment ADD and SUB are the same hardware for unsigned and signed. MUL/IMUL is also the same for the lower half of the result (i.e. 32bit × 32bit = 32bit). So you're ALU and ISA are simple and flexible by design.

replies(1): >>41892436 #
31. ◴[] No.41888570{8}[source]
32. epcoa ◴[] No.41892436{6}[source]
For calculations, of course it’s not simpler or faster. At best, you could probably make hardware where it’s close to a wash.

One that lectures on the importance of college you would think would demonstrate the critical thinking skills to ask themselves why the top supercomputers use 2’s complement like everyone else.

The only aspect of 1’s or sign mag that is simpler is in generation. If you have a simple ADC that gives you a magnitude based on a count and a direction, it is trivial to just output that directly. 1’s I guess is not too much harder with XORs (but what’s the point?). 2’s requires some kind of ripple carry logic, the add 1 is one way, there are some other methods you can work out but still more logic than sign-mag. This is pretty much the only place where non 2’s complement has any advantage. Finally for an I2C or SPI sensor like a temp sensor it is more likely you will get none of the above and have some asymmetric scale. Anybody in embedded bloviating on this ought to know.

In his ramblings the mentions of packed decimal (BCD) are a nice touch. C, C++ has never supported that to begin with so I have no idea why that must also be “considered”.

33. harry8 ◴[] No.41930278[source]
Hahaha, you're including Bjarne in that sweeping generalization? C++ has long had a culture problem revolving around arrogance an belittling others, maybe it is growing out of it?

I would point out that for any language, if one has to follow the standards committee closely to be an effective programmer in that language, complexity is likely to be an issue. Fortunately in this case it probably isn't required.

I see garbage collection came in c++11 and has now gone. Would following that debacle make many or most c++ programmers more effective?