> Thusly, what happens in code that accesses the string after the move is UB.
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.
> So apparently, move does not prevent generation of a copy, but the empty string instead of expected text “Dave” is very interesting. Apparently, after termination of show after the move, the object is invalidated. This does not affect the Person object, but only the string object. Recognize that I speak about a factual behavior on the hardware. I think we have undefined behavior here. And no compilation error.
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.
It's eerily reminiscent of the x86 bashing that was going on in the early 2000s, only that in those days PPC was seen as the superior (new, baggage-free) ISA by Apple fanboys.
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.
Those are Tensor flops, the numbers for the Zen CPU are "general-purpose" flops (sometimes called "vector flops" in marketing material).
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.
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.
> If that's your main example, you are in for a ride. Since asutton branch is over 15 years old almost at this point, and it was by design that no work should happen in LLVM until concepts make it into the standard.
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 :)
> On top of that, many technology companies have built their whole platforms on top of LLVM.
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.
GCC existed and thrived long before companies started putting money into it. It would clearly suffer if, e.g., Red-Hat withdrew its support, but not nearly as LLVM would in the same situation.
The culture, history and governance of the two projects are very different and they do matter.
> Korolev and his team made rapid advances. But even with the full weight of the Soviet economy behind them, they struggled to catch up. The main reason for this was organisational. Whereas the American programme was centrally planned and hierarchically managed, their Soviet counterparts seemed to be almost wilfully chaotic.
As a scientist myself, I strongly disagree. If you spend a non-negligible amount of your time telling a computer what to do, you are, indeed, a programmer. And as such you should be expected to become a decently proficient programmer.
Physicists are not mathematicians, and yet they are required to acquire a relatively high degree of proficiency in maths because maths is a fundamental tool in their job, and nobody would argue otherwise.
The attitude of considering programming a mundane craft to be picked up as-you-go is the main reason why the scientific software landscape is such a shitshow.
I have recently released version 0.3.0 of heyoka, a C++17 library for the numerical integration of ordinary differential equations (ODEs) using Taylor's method. The library uses automatic differentiation techniques and just-in-time compilation via LLVM to synthesize at runtime highly efficient and accurate numerical integrators.
Additional features include batch mode support to take full advantage of SIMD instructions in modern processors, and support for extended-precision computations using 80-bit and 128-bit floating-point types (if supported by the hardware/software platform).
> WW1 was a total war. Fascism was a response to total war which conscripted every civilian into the military.
WWI was a contributing factor to the rise of fascism, which is a complex phenomenon whose roots date back at least to the late 1800s with the rise of nationalism throughout Europe, the unification of Germany, the growing distrust of liberal democracies at the turn of the century, etc. It was not a "direct result" of WWI.
> Italy did not have an army of 500,000 soliders before WW1, no country did. The british empire's armed force was 80,000 -- and was one of the largest in the world. Where do you think 500,000 "soliders" came from? They were drafted from the population.
WWI was unparalleled in magnitude with respect to previous wars, but, as far as Italy is concerned, it did not involve directly the vast majority of the civilian population (around 34M at the time), which was never in a war zone or at risk of atrocities from the opposing force. The fighting was confined to the northeastern Alpine regions of Trentino, Veneto and Friuli. The Austrians made a small advance into the Italian territory before being decisively defeated on the Piave river. The industrial and agricultural heartlands of the country were largely intact at the end of the war, no major urban centres were captured or destroyed, and important land gains were made in the form of new territories formerly under Austrian control.
WWI was hell on Earth in the trenches, but no, Italy was not in disarray and did not experience mass death or poverty as a result of WWI.
(There were of course serious economic issues in the interwar period, but their genesis is in the great depression, not WWI)
> I'm British and I know my own history very well. Read any book of the time, "Road to Wigan Peer" will give you the quality of poverty.
Life has been shit for most people for millenia, in Europe and elsewhere. But just take a look at any graph of the life expectancy over time in Europe and you will see that is has been steadily improving throughout the 20th century (with a couple of big temporary down spikes for the flu and WW2 - not WW1).
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.