Please gcc, let me have a `~/.config/gcc` config file or an ENV variable so I can ask for single lined error messages.
I literally do not need ascii art to point to my error, just tell me line:col and a unique looking error message so I can spend no more than 1 second understanding what went wrong
Also allow me to extend requires with my own error messages. I know it'll be non standard but it would be very nice tyvm
Great interview, more please.
Is there a way to submit question? I'd like to know 1) what affects branch predictors? From my understanding return statements do and cmov does not 2) Why isn't there a conditional exception? to replace if (!cond) { __builtin_trap(); }
Conditional instructions that don't branch or otherwise interrupt the program flow don't necessarily have to cause any pipeline stalls or bubbles. The CPU can decode a cmov and then carry on decoding subsequent instructions (and pass the cmov on to subsequent pipeline stages) well before it's known whether the condition is true. For a branching instruction, the CPU doesn't know during the early phases what the next instruction after the branch will be, so it has to predict and speculate.
> Why isn't there a conditional exception? to replace if (!cond) { __builtin_trap(); }
There's not really any way to make that into something that doesn't branch; the best you can hope for is only one instruction that may branch but hopefully gets predicted accurately. But in the event of an exception, there really does need to be something that can cause the instruction pointer to do something other than advance to the next byte after the current instruction.
One way to avoid the extra code from constructors is to make them constexpr. This way the compiler can initialize it with 0 or a value and not generate all that extra code to execute a constructor at runtime.
I'm not sure how many people interested in this article is interested in C++ compile times but I once measured and wrote an article https://bolinlang.com/wheres-my-compile-time
If you want to write code to show me what you're talking about (best if I can run it) I'll tell you why or why not. I can tell you right now I dislike DI (and singletons) for reasons I can't cover in a single post
I had a feeling someone would bring this up (I'm the author.) Your state really shouldn't be depending on IDs or handles from a counter function. I'm not sure if most people can agree with what is considered using a global variable which is why I wanted to define it near the start
I'm the author. I seen people make mistakes writing pure functions with many if statements in them. For a small period I heard people say loops should be banned. Would you want to go that far?
If your narrow the usage of a global within a file you can get a lot of mileage. That's not how people tend to use globals and why I wanted to write about it
I should have talked more about that in the article. I mentioned defer, making functions reentrant, etc, but languages with exceptions and without defer can make things much harder. I tried to make it clear the global state should be accessible from a handful of functions or within a file/module
There's plenty of things in programming that are "hard to use correctly". I seen many codebases that you must clone an object because passing it in a function because there was so much spaghetti data structures that you'd end up accidentally mutating something you didn't mean
I'm the author. You don't exactly need the program to be small, you could do a lot with a small file (under 500 lines) being the only one able to access a global variable. People seem to think it's ok to leak data from your encapsulation when you're using a global which I tried to say is a bad idea in the article.
I literally do not need ascii art to point to my error, just tell me line:col and a unique looking error message so I can spend no more than 1 second understanding what went wrong
Also allow me to extend requires with my own error messages. I know it'll be non standard but it would be very nice tyvm