bluescarni
Joined 10 years ago
Joined 10 years ago
No, it is implementation-defined behaviour.
> In the implementation of C++ the article uses the string was just empty. But for all we know it may still contain a 1:1 copy of the original or 20 copies or a gobbledygook of bytes.
Yes, and if you want to make sure that the string is empty before you do something else with it, you just use a clear() (which will be optimised away by the compiler anyway).
Or, if you prefer, you can assign another string to it, or anything else really.
> Any code that relies on the string being something (even empty) may behave different if it isn't. That's the very definition of UB.
No it is not.
> "A typical implementation strategy" is meaningless for someone writing code against a language specification.
Then don't rely on that specific implementation detail and make sure that the string is in the state you want or, even better, don't touch the moved-from string ever again.
There is a lot of wrong in this paragraph:
- a "copy" was not generated, at least not in the sense that the actual content of the string was copied anywhere;
- there's no undefined behaviour here and no invalidation of the string. Standard library types are required to be left in an unspecified but valid state after move. "Valid" here means that you can go on and inspect the state of the string after move, so you can query whether it is empty or not, count the number of characters, etc. etc. "Unspecified" means that the implementation gets to decide what is the status of the string after move. For long enough strings, typical implementation strategy is to set the moved-from string in an empty state.
Shades of Star Citizen right there.
Then Apple switched to x86, and from day to night we witnessed the magnificent spectacle of the entire Apple fanbase performing a whiplash-inducing collective pirouette towards the narrative that, after all, x86 was not so bad.
It is you who barged into the thread with unrelated GPU performance numbers, but whatever :)
The vector flops for the 3090Ti are 33 TFlops for single precision, 0.5 TFlops for double precision. So, 16x faster than the 5950x in single precision, 2x slower for double precision. At almost 3x the price and >4x the power consumption.
Of course, if all you care about is AI, then there's no argument - but then we are not really talking about a general-purpose device any more.
The narrative of GPUs being "hundreds of time" faster than CPUs is vastly blown out of proportion for general-purpose computing.
https://github.com/Mysticial/Flops/
You can also get a theoretical computation of the Flops, which matches nicely with the experimental measurement. You have to take into account:
- the clock frequency (~3.9 GHz on multithreaded workloads on my machine)
- the number of cores (16)
- the reciprocal throughput of the FMA instruction (~.5, that is, 2 instructions per clock cycle)
- the number of flops per instruction (2 for the FMA instruction, that is, 1 multiply + 1 add)
- the SIMD vector width (4 for double, 8 for float).
Putting it together:
3.9e9 * 16 * 2 * 2 * 4 = 998.4 GFlops (double)
3.9e9 * 16 * 2 * 2 * 8 = 1996.8 GFlops (single)
The measured values on my machine are a bit different, but close (1070 and 2151 respectively).
References:
https://www.agner.org/optimize/instruction_tables.pdf
https://www.agner.org/forum/viewtopic.php?t=56
https://gadgetversus.com/processor/amd-ryzen-9-5950x-gflops-...
My 5950x (measured) flops are ~2 TFLOPS in single-precision, ~1TFLOPS in double precision (obviously, due to half the SIMD vector size). This is a desktop-class 16-core machine.
Just because American democracy is failing, it does not mean democracy is failing everywhere.
Nice strawman, what does this have to do with anything that I wrote?
You went on and on about how there's heaps of "LLVM PhDs" (whatever that might mean) coming out of academia, so I gave you an example of someone working in academia who developed and contributed a key C++ feature to GCC.
> I can give you a dozen examples, from constexpr, metaclasses, coroutines, modules, etc. where things made it much earlier into LLVM than GCC.
That's not my experience, and I have been using GCC and Clang daily on modern C++ codebases targeting the latest standard for the last 10 years.
> From 2005 to 2014 GCC development severely stagnated, being much slower than clang, having horrible error messages when compared to clang, etc.
Yes, GCC's diagnostics have been trailing Clang's, though they have mostly caught up in the last few versions. But "much slower than clang" is flat out wrong, unless you mean compile-time performance. GCC has for years consistently produced more optimised code than Clang's, and it only in the last couple of years that the two compilers are essentially on performance parity.
> AMD, Intel, ARM, ... they all have proprietary toolchains built on LLVM, and send and merge multiple diffs to LLVM upstream, every day.
I seriously doubt that AMD/Intel/ARM engineers are doing substantial work on C++20 features, but I'd be happy to be proven wrong :)
That is irrelevant, as most of those companies are keeping their modifications to LLVM closed-source. They are not at all interested in fostering a healthy open-source ecosystem around LLVM.
> GCC doesn't really have that.
This is just wrong. Just as a single example, the first ever C++ concepts implementation was written for GCC by Andrew Sutton, a University professor and co-author with Bjarne of the concepts proposal. LLVM's implementation came years later, and it's not as stable or complete to this day.
> If Red-Hat and other private companies withdraw support, there are really few people familiar enough with GCC to keep it afloat, few people interested in learning and contributing because that won't land them industry jobs, etc.
Again, no. There is nothing in the 30+-years long history of GCC that suggests that this would happen.
The 22-25 red line had plateaued before the release of ChatGPT and was already trending downwards by the time ChatGPT appeared.
Additionally, it took a quite a while before vibe and agentic coding appeared and gained traction, and I cannot really see how the precipitous decline between say Jan 2023 and Jan 2024 can be attributed mainly to AI.
The "other" reasons mentioned later in the post seem much more convincing.