Jussi Pakkanen, creator of the Meson build system, writes about C++, programming languages, build tools, and software development practices.
HN links it in discussions of C++ modules and language design; commenters use his posts as references on those topics.
> And for that one, exceptions as they are today are often faster than the equivalent error-code-based code: https://nibblestew.blogspot.com/2017/01/measuring-execution-...
The example on that blog post is not representative of how error codes are used.
On all programming languages, C included, but also Rust, functions return a completion value that's either success, or error (and when its error, it includes which error it is, and the error state, etc.).
int foo();
switch (foo())
case 0: break; // success
case 1: /* error case 1 */
case 2: /* error case 2 */
...
Instead, the blog post has the function return some value in registers that is not an error, and passes the function an ErrorState* as an argument, that the function first sets via memory, and then the handler reads, also via memory.
That this is slow is not rocket science, which is why nobody does this.
I get why the author has to do it. If they were to do it right, error codes would perform significantly better than exceptions. Since returning the error or success is "free" (the function has to return anyways, and up to 2 registers are reserved by the ABI anyways).
Somebody mentions this in the comments, were as far as fixing it and sending a PR (https://github.com/jpakkane/excspeed/pull/1) but the author complains that this is not how GLib does error codes, so they don't care.
So yeah, if you do C error codes like GLib does, which is essentially a poor man's emulation of…
This reply frustrated me to the core. This isn't a parenting website. The advice you gave is a parenting one, and bad, at that. The story could have just been concocted for the benefit of understanding the urgency of the situation.
You should probably read this: https://nibblestew.blogspot.com/2020/04/your-statement-is-100-correct-but.html?m=1
It'll make you a little wiser.
As to why your reply frustrated me? I think the internet is overwhelmed by [...] trying to draw lines where no limit should really be required (please note that I'm referring to your comment, not to the request for any sort of protection on Virus Cafe...).
The problem wasn't that he/she gave the ipad/iphone to the daughter, but the lack of security on the site. Better people than us said this is actually illegal, so you see, you're slightly out of line.
I wanted to somehow say you're right, but irrelevant. But you aren't even right. Even a 6 yearold should have access to an iphone or an ipad, CONNECTED TO THE INTERNET, as it were.
The situation forks: 1 - enable parenting rights on the device
...which would mean that if I just want my kid to experience the iphone for 5 minutes I have to enable a feature that afterwards I need to disable... (this forks again, about 3 ways)
2 - buy one especially for the kid
...I don't even want to start... (this actually forks in volumes and volumes of pros and cons)
So let's just stick to the real problem here:
I (and when I say I, I mean a forty smthg yearold) was on…
> I don’t care in which language my editor is written in.
Sure you do. If I offered you a version of your current editor in the Befunge programming language, you'd rightly decline!
Programming languages aren't just all "basically the same".
Programming language choice, communicates something because programming languages have values.
Would you prefer a text editor written in Ruby or one written in Python?
This relates to a favorite article of mine:
It's not what programming languages do, it's what they shepherd you to.
https://nibblestew.blogspot.com/2020/03/its-not-what-programming-languages-do.html
To tie in one of the article's examples:
> Perl shepherds you into using regexps
If you believe that regexes are hard to debug and overly complex, you might resist a text editor written in perl because it's likely that regexes are used everywhere (even when they shouldn't be).
Looking at the examples from using Clang (I use GCC btw.):
clang++ -std=c++20 Hello.cppm --precompile -o Hello.pcm clang++ -std=c++20 use.cpp -fmodule-file=Hello=Hello.pcm Hello.pcm -o Hello.out ./Hello.out Why is something which shall makes things easy and secure so complicated?
I'm used to:
g++ -o hello hello.cpp It can use headers. Or doesn't use headers. I doesn't matter. That's the decision of the source file. To be fair, the option -std=c++20 probably isn't necessary in future.
I recommend skimming over this issue from Meson:
https://github.com/mesonbuild/meson/issues/5024
Reading the last few blog posts from a developer of Meson, providing some insights why Meson doesn't support modules until now:
https://nibblestew.blogspot.com/
It's very easy to explain and there are many examples of bad Makefiles on the internet. Magic variables, unintelligible string replacement routines, unportable extensions. Almost nobody understands the finer points like = vs := and execution order. Using a simple scripting language with well known semantics can be relieving. Maybe try this? http://nibblestew.blogspot.de/2017/12/a-simple-makefile-is-unicorn.html
Creating dummy files is inefficient, inelegant, and unmaintainable. Changing SHELL does not solve the inconvenience of having start a new process and having to go through a command-line interface each time.
Btw. watch your language, please.
it's obvious that OP meant a performance cost - as generally when you program in C++ that's the n°1 metric. And for that one, exceptions as they are today are often faster than the equivalent error-code-based code: https://nibblestew.blogspot.com/2017/01/measuring-execution-performance-of-c.html
Of course if we can get even faster exceptions such as the throwing values model, by all means let's do it... i'm entirely fine with recompiling literally every software / library I use if that can get me half a % more performance