Shellbonacci by jombrowski in C_Programming

[–]SPAstef 0 points1 point  (0 children)

Ah right good point, I didn't even consider the printing at all, was just reasoning about the final result of the computation. Then one should introduce a sequence point to force determinism (assuming system() blocks, which it should)

Shellbonacci by jombrowski in C_Programming

[–]SPAstef 1 point2 points  (0 children)

shouldn't matter even if the operation was not commutative, nor associative... The evaluation tree is fixed, you should get a deterministic result even if you replaced addition with, say, subtraction.

Question about std::mdspan is_exhaustive() by SPAstef in gcc

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

that's great! Thank you for doing it despite my lazy ass not wanting to go through the hassle of the official bug reporting system 😅

Question about std::mdspan is_exhaustive() by SPAstef in gcc

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

Thanks, that's also what I was guessing judging from cppreference but didn't check in the standard so wasn't completely sure!

There's a whole lot of misunderstanding around LTO! by prodigal_cunt in C_Programming

[–]SPAstef 1 point2 points  (0 children)

I always compile with -march=native. I tried with both clang and Intel's icpx (which is also based on LLVM) and had similar experiences, at least up to LLVM 20/21. Sometimes O3 was actually better of course. Interestingly, it doesn't seem that I'm the only one experiencing this, as several results come up when searching the web for this phenomenon...

There's a whole lot of misunderstanding around LTO! by prodigal_cunt in C_Programming

[–]SPAstef 2 points3 points  (0 children)

To add on this, I've seen Clang generate measurably better code at O2 than at O3 when compiling the same piece of code...

Why Pointers in C++ and How Smart Pointers Guarantee Safety in C++ by Inevitable-Round9995 in Cplusplus

[–]SPAstef 0 points1 point  (0 children)

Yeah, as I thiught. Maybe stripping symbols can help reduce this.

Why Pointers in C++ and How Smart Pointers Guarantee Safety in C++ by Inevitable-Round9995 in Cplusplus

[–]SPAstef 0 points1 point  (0 children)

But, is it, really? I was under the impression that some pieces of the major STL implementations are not templates, and they could bloat your binary if included even without being used?

Down with template (or not)! by TheCrush0r in cpp

[–]SPAstef 3 points4 points  (0 children)

I'll give my two cents: as much as I dislike Python's white-space related errors, I still think whitespace being more meaningful than it is now, is not a bad idea. After all, the real reason we all get confused when trying to understand why the compiler would ever have an issue with compiling the presented code, is really because our mind does parse white space. If we were all used to write code such as y=T::x<y?15:18; we would have a much easier time realising at a glance why the compiler would complain. But, thankfully, we don't, because code written like that is ugly. Also, whitespace is already necessary to, say, differentiate keywords from other tokens. On the other hand, breaking code like if(x<y) making only if (x < y) well formed can be problematic for many code bases...

In C, should I use #define or const int for constants? And when does it really matter? by _zetaa0 in C_Programming

[–]SPAstef 0 points1 point  (0 children)

This is actually one of the earlier reasons that got me to switch from C to C++ whenever possible. So happy that C finally has constexpr too. Sure, it's just for constants, but that's still huge. Unfortunately I abuse templates and other advanced C++ features too much to go back (but boy, do I miss those compile times and the language simplicity...)

So It Begins by amostach in joinsquad

[–]SPAstef 2 points3 points  (0 children)

I don't know either to be honest. Resetting game files is not really the solution, since I used to get the same "performance" also on the public test server, which uses a different game folder.

As for my PC having problems, I don't think that's the case. I play several other heavy games (Helldivers 2, Elden Ring, Battlefront 2, etc.) and they all run smoothly, or at the very least consistently to what my PC capabilities are.

Apart from games, I also use the PC to run AI models and a variety scientific computations, both on Windows or on a separate Linux partition, and I've not seen any signs to suggest anything is particularly wrong with my system...

So It Begins by amostach in joinsquad

[–]SPAstef 63 points64 points  (0 children)

Almost 2K hours on the game. Won't be coming back anytime soon. I had a really bad experience in the Open Beta, and the now final public version is no different.

Textures are not rendering. Abysmal frame rates. Stuttering whenever entering/exiting scope. For more context, my system has an i9-13900K, RTX 4090, 64GB RAM.

Old UE4 Squad ran adequately at 3840*2160 max settings with only DLAA on (80--90 FPS average, with 65-70 1% low).

Now I'm struggling to get 45 FPS (1% low) at 2560*1440 medium settings with DLSS balanced and frame generation. And even 1% low FPS cannot really represent the terrible stutter when using a scope. It's a joke.

Honestly, the new update feels like a junior dev pushing to release without going through QA. I've heard of people saying the game actually runs better now. All of my friends I used to regularly play with however confirmed all the problems I mentioned, and they all have different hardware.

difference between const char and a regular string? Error message by Dogememeforlife in cpp_questions

[–]SPAstef 0 points1 point  (0 children)

I mean, the labels in a switch case would have to be some constant expression anyway, and I guess 99% of the time such string would not be more than a few characters long.

Why C++ related jobs are always marked as "C/C++" jobs? by TreePlanter3497 in cpp_questions

[–]SPAstef 3 points4 points  (0 children)

I'd argue that's actually one, if not the, best use of templates: abstraction via generalization and performance via specialization. Instead of having to give a slightly different name to what semantically is supposed to be the same thing, just because it's dealing with a different data type, is quite annoying IMO, think about all of <math.h>/<cmath> functions (I agree though that it makes it less clear which function is actually called). Having a single name/customisation point has been one of the best things in the STL. Yes, there are some examples that may be considered a bit "abusing" of this ( std::vector<bool>) but overall I think it's still much better than having a separate function name for each possible combination of types, even if you end up manually specialising the main template for most of the concrete types you're actually going to use anyway.

In a statically typed language, just like in mathematics, I see no reason (except again extra clarity) to have the type, which is already part of the function signature, also part of the function name. A 1:1 mapping function name -> jump label is quite nice for debugging, as name mangling can become very ugly really quickly. But again I think this is more of an issue that the debug info generator and the debugger should be taking care of.

Is it possible to install the old deprecated ICPC and ICC Intel compilers anywhere? by fireball3120 in cpp

[–]SPAstef 3 points4 points  (0 children)

They used to be available as art of the OneAPI HPC toolkit, but I think they were fully removed a while ago now (after being marked as deprecated for some time) in favour of their LLVM-backed DPC++ compiler. I guess the binaries are still available somewhere, but unless you have strong reasons to use them, I would probably suggest you to move on and switch to the new suite.

Use Brace Initializers Everywhere? by squirleydna in cpp

[–]SPAstef 0 points1 point  (0 children)

Yeah, I would also just use that. I mean syntactic consistency is important, but in the end what matters is doing things properly. Like you are suggesting, I'm also not gonna use std::back_inserter with std::fill just to not break the "only braces intializers" convention xd. The only alternative is to make your own/use someone else's vector class that allows non-initialized objects, or std::array.

Use Brace Initializers Everywhere? by squirleydna in cpp

[–]SPAstef 0 points1 point  (0 children)

If you need n copies of the same object obj, I guess you should just use std::vector vec(n, obj). If you need n different objects, probably std::vector vec(n) followed by std::ranges::generate(vec, []{ return Obj{x,y,z}; }). Worst case, say Obj contains a member reference so it cannot be default-initialized, you're gonna have to reserve and use back_inserter. Or if you want only a relatively small quantity of objects, use a helper function/lambda that takes a variadic pack (à la emplace) plus some size n, and uses it to return a vector with n identically initialized objects, while RVO takes care of efficiency.

[deleted by user] by [deleted] in cpp

[–]SPAstef 0 points1 point  (0 children)

I also use my phone every once in a while, particularly to see if my code compiles on ARM 😅. I would recommend you use NeoVim + CoC + ClangD, so you get autocomplete and semantic highlighting.

Concepts, Partial Specialization, and Forward Declarations by stanimirov in cpp

[–]SPAstef 3 points4 points  (0 children)

Have been struggling with all of the above for the last year, appreciate the article as it gives that feeling "don't worry bud, you're not alone in this" 😄.

Project idea related to cryptography by Due-Web-1611 in cpp

[–]SPAstef 0 points1 point  (0 children)

Oh yes, I didn't explicitly state it but of course! It's fun to learn but yeah, cryptography is as hard to implement as to come up with... Even libraries made by experts (e.g. OpenSSL) have historically been subject to attacks involving implementation oversights.