Earlier quoted context omitted.
Agreed. I wouldn't mind if, say, end of line comments weren't perfectly aligned. There's zero indentation so things like for (string line; getline(is,line); ) s.insert(line); are hard to visually parse.
This must depend on some settings of the browser and perhaps also on the locally installed typefaces. On my Firefox on Linux, this HTML page is not rendered with any custom typefaces, but it uses those specified by me as defaults for serif/sans serif/monospace. The C++ code is rendered in my browser with my default, i.e. with JetBrains Mono and there is nothing weird. The code quoted by you is indented as expected, n…
21st Century C++
61–70 of 281 posts
Re: 21st Century C++
#62Earlier quoted context omitted.
This is a Bjarne issue. For personal reasons he uses proportional fonts in his code blocks (in his texts) instead of monospaced and the code snippets always look bad. I guess he is stuck in his ways, just have to work around this ugly look.
> This is a Bjarne issue. I have come to find this category of error to be distressingly large.
If a proportional font is used for rendering, the most likely cause is that the user has not configured the default monospace font in the settings of the browser.
Re: 21st Century C++
#63Something about the formatting of the code blocks used is all messed up for me. Seems to be independent on browser, happens in both Firefox and Chrome.
It's typical Stroustrup style to write code in a variable width font. I'd wager they didn't have an option to use a variable-width font in their code blocks in their CMS and normal paragraphs are trimmed automatically. I didn't see the author at first. However, immediately after seeing the code I checked for the author, because I was sure it was Stroustrup.
On my browser, all the code is properly indented, most likely because my browsers are configured correctly, i.e. with a monospace font set as the default for "monospace".
Whoever does not see indentation, most likely has not set the right default font in their browser.
Re: 21st Century C++
#64Something about the formatting of the code blocks used is all messed up for me. Seems to be independent on browser, happens in both Firefox and Chrome.
The code blocks aren't in a preformatted tag like so the whitespace gets collapsed. It seems the intention was to turn spaces into but however it was done was messed up because lots of spaces didn't get converted.
My browser has an appropriate default monospace font (JetBrains Mono), so the code is formatted and indented correctly, as expected.
Where this does not happen, the setting for the default monospace font must be wrong, so it should be corrected.
Re: 21st Century C++
#65Earlier quoted context omitted.
Start by removing Rust's dependency in GCC and LLVM, both written in C++.
Rust doesn't "depend" on LLVM in the sense you seem to imagine, you can instead lower Rust's MIR into Cranelift (which is written in Rust) if you want for example. LLVM's optimiser is more powerful, and it handles unwinding, so today most people want LLVM but actually I think LLVM's future might involve more Rust.
Similar to how much Python folks disregard PyPy's existence.
I doubt LLVM project would start accepting polyglot contributions, beyond what they already do for language specific frontends.
Also, the ongoing GCC support is dependent on C++ as well.
Re: 21st Century C++
#66Earlier quoted context omitted.
The code blocks aren't in a preformatted tag like so the whitespace gets collapsed. It seems the intention was to turn spaces into but however it was done was messed up because lots of spaces didn't get converted.
The code blocks are formatted as "wp-block-code", which seems to select the default monospace font of the browser. My browser has an appropriate default monospace font (JetBrains Mono), so the code is formatted and indented correctly, as expected. Where this does not happen, the setting for the default monospace font must be wrong, so it should be corrected.
Re: 21st Century C++
#67Here's how Bjarne describes that first C++ program: "a simple program that writes every unique line from input to output" Bjarne does thank more than half a dozen people, including other WG21 members, for reviewing this paper, maybe none of them read this program? More likely, like Bjarne they didn't notice that this program has Undefined Behaviour for some inputs and that in the real world it doesn't quite do what's…
The collect_lines example won't even compile, it's not valid C++, but there's undefined behavior in one of the examples? I'm very surprised and would like to know what it is, that would be truly shocking.
The first example uses the int type. This is a signed integer type and in practice today it will usually be the 32-bit signed integer Rust calls i32 because that's cheap on almost any hardware you'd actually use for general purpose software.
In C++ this type has Undefined Behaviour if allowed to overflow. For the 32-bit signed integer that will happen once we see 2^31 identical lines.
In practice the observed behaviour will probably be that it treats 2^32 identical lines as equivalent to zero prior occurrences and I've verified that behaviour in a toy system.
Re: 21st Century C++
#68[flagged]
> It is so objectively horrible in every capacity, Total hyperbole and simply not true. > but it still somehow managed to limp on for all these years Before Rust became somewhat popular, there was simply no serious alternative to C++ in many domains.
Re: 21st Century C++
#69The C++ Core Guidelines have existed for nearly 10 years now. Despite this, not a single implementation in any of the three major compilers exists that can enforce them. Profiles, which Bjarne et al have had years to work on, will not provide memory safety[0]. The C++ committee, including Bjarne Stroustrup, needs to accept that the language cannot be improved without breaking changes. However, it's already too late.…
Re: 21st Century C++
#70[flagged]
> Between Rust and Zig, the problems of C++ have been solved much more elegantly Those languages occupy different points in the design space than C++. And thus, in the general sense, neither of them, nor their combination, is "C++ with the problems solved". I know very little Rust and even less Zig. But I do know that there are various complaints about Rust, which are different than the kinds of complaints you get ab…
That's a fine case of Stockholm Syndrome you've got there. In reality, it is hard. The language fights you every step of the way. That's because the point in the design space C++ occupies is a uniquely stupid one. It wants to have it's cake and eat it too. The pipe-dream behind C++ is that you can write code in an expressive manner and magically have it also be performant. If you want fast code, you have to be explicit about many things. C++ ties itself in knots trying to be implicitly explicit about those things, and the result is just plain harder to reason about. If you want code that's safe and fast, you go with Rust. If you want code that's easy and fast, you go with Zig. If you want code that's easy and safe you go with some GCed lang. Then if you want code that's easy, safe, and fast, you pick C++ and get code which might be fast. You cannot have all three things. Many other langues find an appropriate balance of these three traits to be worthwhile, but C++ does not. It's been 40 years since the birth of C++ and they are only just now trying to figure out how to make it compile well.