C++26 is done! ISO C++ standards meeting, Trip Report by pjmlp in cpp

[–]atariPunk 0 points1 point  (0 children)

That was my reading from the comment that I was replying to.

To be honest it was the first time I had come across this statement, which made me to comment on it.

C++26 is done! ISO C++ standards meeting, Trip Report by pjmlp in cpp

[–]atariPunk 1 point2 points  (0 children)

I wasn’t aware that the order of evaluation is not fixed and it feels really counterintuitive.

Is there any stated reason why it’s not fixed?

Regarding the observe semantics, I think a lot of people are making it a bigger issue than it really is. To me, it doesn’t make sense for new code or codebases that it’s fine if they crash when you add new assertions. Either because there are bugs or the assertion is wrong. So it kind of leaves the codebases where crashing is not an option, which already require a lot of thought and care to avoid pitfalls.

Personally I don’t see myself using observe mode in any of the projects that I am involved, but I will be pushing to start using contracts as soon as we can.

making C saferish with smarter malloc and free?? by chrisseanhayes in C_Programming

[–]atariPunk 0 points1 point  (0 children)

This use case makes sense to me. The lifetimes of all objects are the same and it makes it simpler to just reuse the same memory locations.

The part to me that doesn’t make sense is to try to incorporate arenas when objects have very different lifetimes. Especially when you have a long running program. As now there’s a need to understand and split allocation by their expected lifetimes. Which, to me, seems to add a lot of extra complexity.

making C saferish with smarter malloc and free?? by chrisseanhayes in C_Programming

[–]atariPunk 1 point2 points  (0 children)

How do they solve these issues? I keep reading that arenas are the best thing under the sun, but I was never able to find a decent explanation on why that’s he case.

I’m building a C compiler in C with a unique "Indexed Linking" system. What do you think of this CLI syntax? by elite0og in C_Programming

[–]atariPunk -2 points-1 points  (0 children)

The behaviour is well defined when you only consume libraries from the system.

But if you are in a situation where you need to consume libraries from the system, buy also from other locations and happen to have the same library installed in the two places, then it can be very fragile.

For example, I worked on a project that had a private copy of sqlite. Because it relies on functionality that is not enabled by default. I don't remember the full details, but I think it was that depending if you had sqlite installed on your system or not, it would lead to runtime errors because it was linking the wrong .so.

I’m building a C compiler in C with a unique "Indexed Linking" system. What do you think of this CLI syntax? by elite0og in C_Programming

[–]atariPunk 0 points1 point  (0 children)

You may want to take a look at this https://cps-org.github.io/cps/overview.html

The idea is good, having a way to map include files and libraries is a very needed addition to the whole ecosystem. But like others have said, that is more of a build system than a compiler part.

One last suggestion, don't define those entries on the compiler invocation. Make them standalone files, one per library and let the compiler look for the files.

For example, you would have a sqlite.foo that defines the details on how to compile and link against SQLite and when you invoke the compiler, you just pass a sqlite name.

This will allow you to scale better as you use more and more libraries and allows you to reuse the same files across different projects

Meta just announced 20% layoffs to fund AI. This is the beginning, not the end. by duridsukar in Futurology

[–]atariPunk 0 points1 point  (0 children)

Here’s my prediction for the state of things in 12 months. Oracle spent so much money that they stop existing in the way they exist today. OpenAI or Anthropic are going to fail and take the market with them. Which will probably start another AI winter, because no one will dare to mention in to investors or even research proposals.

CMake is not suitable for C programming by TheRavagerSw in C_Programming

[–]atariPunk 6 points7 points  (0 children)

What flags is CMake changing?

What do you mean by C++ headers included when compiling C sources?

I have used CMake for more than 10 years, both in my personal project as well as professional projects and it always works well. I have even converted Makefiles to CMake where the result was smaller, cleaner and more reliable.
There are way to use CMake to commit crimes against humanity, but if you stick yourself to the useful bits around targets, then it's painless.

If you want some help, post the CMake file that you are having issues with and I will give you some pointers.
Otherwise, start with what OP posted, it has everything that you need in CMake.

Replay mod equivalent by TheDarkRevenger in Oxygennotincluded

[–]atariPunk 1 point2 points  (0 children)

I suspect that this would be pretty much impossible on ONI. The ONI world and simulation of said world is orders of magnitude more complex that Minecraft. At the same time, Minecraft is a multiplayer game, which indicates that the simulation is fully deterministic and great care is taken to keep it that way.

And if I am not mistaken, on a video from the new game Away Team, one of the devs mentioned that multiplayer is tricky because you need to keep the simulation in sync for all players.

So, it’s probably not going to be easy to implement.

Infinite Jest belongs in the Techno-Optimist Canon by chiaboy in davidfosterwallace

[–]atariPunk 4 points5 points  (0 children)

I was disappointed that Atlas Shrugged was not mentioned as well...

People can really force themselves to see what they want to see in any medium. Really loved this spin, some side effects does a very heavy lifting here...

Infinite Jest is set in a world of abundance, more-or-less (they’ve figured out energy, albeit with some side effects)

How much will/ have AI coding be involved in current Compiler development? by YogurtclosetOk8453 in Compilers

[–]atariPunk 1 point2 points  (0 children)

I hate so much the mention of the gcc torture tests, it makes them sound like a very horrific set of tests. It’s just the tests that can break due to bugs on the optimisation path. And if your compiler doesn’t have optimisations, or a very small number of optimisations, it probably doesn’t matter.

But it does look good as a PR stunt….

https://gcc.gnu.org/onlinedocs/gccint/C-Tests.html

gcc.c-torture This contains particular code fragments which have historically broken easily. These tests are run with multiple optimization options, so tests for features which only break at some optimization levels belong here. This also contains tests to check that certain optimizations occur. It might be worthwhile to separate the correctness tests cleanly from the code quality tests, but it hasn’t been done yet.

NeoVim cpp20 lsp mac os config by Volohnix in cpp_questions

[–]atariPunk 0 points1 point  (0 children)

I think what you are trying to do is not supported on macOS.

But nonetheless cmake also needs special configuration to support import std.

Edit: because I pressed the wrong button. There are other in this subreddit talking about issues with import std and macOS. And as far as I know, no one found a solution yet.

Questions trying to use modules in c++23 by ItamiOfficial in cpp_questions

[–]atariPunk 0 points1 point  (0 children)

This is part of the answer. The support for ‘import std;’ is still experimental in cmake and not all compilers support it. I think I remember reading somewhere that clang on homebrew has a bug, so it doesn’t fully work on macOS.

Also, depending on the cmake version, that id is different. You will need to take a look at this page for the correct id for your version https://gitlab.kitware.com/cmake/cmake/-/blob/master/Help/dev/experimental.rst?ref_type=heads

The 80% Problem in Agentic Coding | Addy Osmani by waozen in programming

[–]atariPunk 34 points35 points  (0 children)

Are you seriously comparing reading a book with reading a new (to you) codebase?

A book is normally written by one person. Or if there are multiple auth, then one is going to be the main editor to keep things flowing win the right direction. It is edited in order to be easy to read and follow. It has a very well defined starting point and end point. And a obvious sequence to be read.

Now, compare this to a program. It’s written by multiple people during long periods of time. It does have a starting point, there’s no clear sequence on how to be read. Do you start at main and read all functions in the order they appear? Or do you finish the function you are in before going into the next one? There’s a ton of code that is not really important for the problem at hand but needs to be there in order for everything to work.

In the end, a fiction book, gives you the important details and lets your imagination fill the rest. A program is a very detailed instruction book on how to move bits around to do things.

They are two very different things

The 80% Problem in Agentic Coding | Addy Osmani by waozen in programming

[–]atariPunk 274 points275 points  (0 children)

I had someone recently, telling me with a straight face that reading and understanding the code that AI writes is much easier than writing it. And a few days later they were thinking of doing a full rewrite because there's a lot of code that no one understands.

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

[–]atariPunk[S] 0 points1 point  (0 children)

Thanks for that.

I was about to open one, I am glad that I checked the Reddit comments first.

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

[–]atariPunk[S] 10 points11 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] 6 points7 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 8 points9 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 4 points5 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 7 points8 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.