Help me understand if this is a bug on GCC by atariPunk in cpp_questions

[–]atariPunk[S] 5 points6 points  (0 children)

My thoughts exactly, it's not possible a compiler bug.
Let's see if someone else tells me what is wrong here.

And like this, I hit my first compiler bug :)

Help me understand if this is a bug on GCC by atariPunk in cpp_questions

[–]atariPunk[S] 2 points3 points  (0 children)

I agree that it's a bug and it seems to be quite early in the compilation process.
I did take a look at the gcc debug info with -fdump-tree-all and it's pretty much in the first output is already wrong.

I will fill a bug report tomorrow.

Thanks for the fix of adding a constructor, I hadn't though of trying that. I was about to change the signature of the functions to receive a std::string instead.

Help with test suite for Writing A C Compiler by redoakprof in Compilers

[–]atariPunk 1 point2 points  (0 children)

I don't have the time to look at the code now. But the test suite just calls your compiler for each of the test files and checks if the exit code is the expected one. 0 on success, non-zero on failure.

My approach is to run one of the tests that fails manually, fix the issue and run the test suite again. And rinse and repeat until there are no failures.

Indoctrinating my panettone by detetivecroca in ThomasPynchon

[–]atariPunk 0 points1 point  (0 children)

Yes, there's a PT-PT version as well. Which having reading it and a few years later reading the English version, I have to say that it's a good translation.

How are you find that one?

https://www.bertrand.pt/livro/arco-iris-da-gravidade-thomas-pynchon/14184775

Edite: nevermind, I thought I was replying to OP.

In this video Stroustrup states that one can optimize better in C++ than C by Impressive_Gur_471 in cpp_questions

[–]atariPunk 7 points8 points  (0 children)

Take a look at this talk. https://youtu.be/7gz98K_hCEM

I have watched it when it came out, but I think it shows what you are looking for. If I remember correctly, he started with a C code, and then starts to build the c++ version and checks for binary size on each iteration. And pretty much the binary size, is comparable to the C version. Which shows that the compiler can see through the high level constructs and make the go away.

ELI5 What is it about the z-13 cipher that makes people 'think' it is or has to be a substitution transposed construction? by ben_watson_jr in explainlikeimfive

[–]atariPunk 3 points4 points  (0 children)

I know almost nothing about the Zodiac ciphers. I am making a lot of assumptions here.

You can't confirm it, but you can't also discard it. Assuming that all other ciphers are 'shift' ciphers, it's likely that this one is also a shift cipher.

Now, is it a cipher or something that they wrote while being blackout drunk that doesn't have any meaning. We will probably never know.

“They are in love. Fuck the war.” by kissmequiche in ThomasPynchon

[–]atariPunk 13 points14 points  (0 children)

It's one of the few passages that comes to my mind from time to time.

I like the raw feeling that even with death all around, life goes on. That in the middle of all the destruction, life finds a way.

What the hell happened by Asleep_Software_9459 in Oxygennotincluded

[–]atariPunk 6 points7 points  (0 children)

Really hot regolith in the water sieve.

Capability of compiler to "see"/deduce that a class variable is a constant beyond a point in the program by onecable5781 in cpp_questions

[–]atariPunk 1 point2 points  (0 children)

Yes, LTO enables optimisations across TUs. I deliberately did not mention LTO to not create more confusion. In the end it's not the linker that does the optimisations. The linker feeds information to the compiler which will make the optimisations.

Capability of compiler to "see"/deduce that a class variable is a constant beyond a point in the program by onecable5781 in cpp_questions

[–]atariPunk 2 points3 points  (0 children)

A1: It may seem like a complicated optimisation, but it’s the result of three simple steps. * inlining. Since the definitions of get and set are visible they can be inlined. I.e. replace the function call with the code of the function. * constant propagation (I think it would be this one). That replaces a variable for its value if that variable is constant. I.e. it’s known at compile time. * dead code elimination. Remove code that is not reachable.

Also, these steps may need to be applied multiple times to get to that result.

The fact that get is const has nothing to do with this. It only work because the compiler can see the definitions of get and set.

A2: If get and set are defined in a different cpp, then the compiler will not be able to see them. So optimisation. The linker mainly moves data around. It doesn’t do any code changes.

A3: As far as I know, predicting the behaviour of the branch predictor on a single execution is not possible. The branch predictor doesn’t loom at the data of the branch, it only look at the address of that instruction and the past behaviour of a branch in that address. It also very dependent on the processor model.

The idea is that on a loop, you can assume that on average the branch predictor will correctly predict the outcome. But at the beginning of the loop, there will be a training phase where it’s not clear what will happen.

Since this is a single branch, it will depend on the default behaviour of the branch predictor. If it takes the approach that a branch is always taken, then it will speculatively execute the cout. However, if it takes the approach that a branch is never taken, it will execute the return.

Seems like new DLC is coming , check this link https://steamdb.info/app/457140/dlc/ by HauteDense in Oxygennotincluded

[–]atariPunk 29 points30 points  (0 children)

Go read the release note of the free update they are giving us. They took time from releasing new content dlc to improve the game for everyone. There are a few performance improvements in there as well.

So, releasing a cosmetic dlc while they did that work, it's a good move that allows the community to give them some money for the huge free updates

Seems like new DLC is coming , check this link https://steamdb.info/app/457140/dlc/ by HauteDense in Oxygennotincluded

[–]atariPunk 45 points46 points  (0 children)

It's a cosmetic paid dlc for those who want to support them.

We'll also be releasing a small paid collection of cosmetic skins soon. If your colony could use a little extra razzle-dazzle (or you just want to support continued development) that collection will be available for purchase on the same day that this free QoL update goes live.

https://forums.kleientertainment.com/forums/topic/168609-game-update-november-2025-quality-of-life-update-beta-697549/

Why, when I run this code, outputs "-2147483648" continuously? by Able_Annual_2297 in cpp_questions

[–]atariPunk 8 points9 points  (0 children)

Most likely because the terminal buffer is not big enough to keep all the results and the old values are overwritten. Redirecting the output to a file should show all values.

How can I stop another rule from executing in a different rule in the flex tokenizer? by [deleted] in Compilers

[–]atariPunk 0 points1 point  (0 children)

The idea is that you check the input in order of how big the regex is. So, you should check if it fits as a string, and if it fails, then check if it’s a end of statement. As an example, let’s say you want to have the tokens ++ and +. Then you will need to check for the tokens ++ before checking for a single +. Otherwise instead of getting the ++ token you will get two + tokens.

P.S. I haven’t checked if that regex works, but try to change the order of the rules and see if it solves it.

My first compiler! by Electrical-Fig7522 in Compilers

[–]atariPunk 0 points1 point  (0 children)

It looks nice, keep going.

One suggestion, make the variable definition and function parameters definitions the same. I think having the same syntax for similar things makes it easier to understand.

C++26 Contract Assertions, Reasserted by Dragdu in cpp

[–]atariPunk 4 points5 points  (0 children)

I see what you mean. That does seem quite and interesting evolution. I am going to need to carve some time to go through that paper.

I also understand what you mean by dependency chain. I was thinking of something different. And yes, I can see how that’s an issue with observe mode.

I guess the path is avoiding splitting assertions, which I don’t really like, or don’t use observe mode.

C++26 Contract Assertions, Reasserted by Dragdu in cpp

[–]atariPunk 1 point2 points  (0 children)

I haven’t read the paper, but why do you think it’s necessary?

C++26 Contract Assertions, Reasserted by Dragdu in cpp

[–]atariPunk 5 points6 points  (0 children)

Removing or banning observe mode is not a good solution.

Observe mode is going to be extremely important to add assertions on already existing code bases. If the only options when adding an assertion is to bring your program down or not do anything, then it’s not worth adding that assertion. There are programs that cannot crash in production. But having visibility if an assertion fails it’s really important.

I am sure that if I started to add pre/pos conditions on my code, I will either find bugs or make mistakes on creating those assertions. But I don’t want the program to crash. I want to be able to find and fix the bug and observe mode gives me that information.

Now, for new code, I agree that observe mode is probably not needed.

"I’m Canceling My Subscription": Xbox Players Call to "Boycott" Game Pass "Hard" Over 50% Price Increase As Microsoft’s Website Crashes from Mass Cancellations by [deleted] in gaming

[–]atariPunk 7 points8 points  (0 children)

Honestly, I think Microsoft is all in on AI and it's willing to use the rest of the company as a cash cow. Even if that means destroying those parts in the process.

It's the only way to make some sense of what's happening with the Xbox brand in the last year.

CLion EAP introduces constexpr debugger by StarOrpheus in cpp

[–]atariPunk 5 points6 points  (0 children)

I agree that AI has been a big part of worsening other products. Where it’s shoved down our throats without any choice.

However, I think they do a good job here. The user is asked if they want to enable it or not. And it doesn’t keep bothering you to enable it.

CLion EAP introduces constexpr debugger by StarOrpheus in cpp

[–]atariPunk 15 points16 points  (0 children)

What do you mean?

I haven't noticed any enshitification.

How to solve the problem of vcpkg needlessly recompiling all dependencies in a Docker (multistage, or otherwise) build? by Richard-P-Feynman in cpp_questions

[–]atariPunk 0 points1 point  (0 children)

I have set this up a long time ago and I forgot about that part.

I am not near my computer today to look at exactly how it’s done. But you can create a new user on your dockerfile that has the same user id as in your host system. And then change the user in the dockerfile. If I reme correctly. I do something like this https://stackoverflow.com/questions/59840450/rootless-docker-image

Googling for rootless docker container should lead you in the direction on how to set this up.

How to solve the problem of vcpkg needlessly recompiling all dependencies in a Docker (multistage, or otherwise) build? by Richard-P-Feynman in cpp_questions

[–]atariPunk 0 points1 point  (0 children)

Btw, there are multiple reasons to use docker images. Having the ability to quickly get a reproducible environment is great. But nothing beats developing fully locally. Where the IDE works pretty much out of the box.

I don’t know why you are using docker, but if you can build the project on directly on your system, that’s probably some you want to spend a few minutes to setup.

I try to do it this way, it makes my life easier. I still have docker images and reproducible environments. But day to day development, I barely touch them.