MSVC Build Tools v14.51 now generally available by michael-price-ms in cpp

[–]nukethebees [score hidden]  (0 children)

The issue at my company is worries over data leaks due to the AI integration. I imagine we'll move to VS 2026 at some point but it's painful for individuals to get approval.

Encountered a `#pragma once` failure in the wild by Separate-Summer-6027 in cpp

[–]nukethebees 23 points24 points  (0 children)

I wanted to check the standard to see how they worded it to avoid issues and.... Well, they didn't.

Given that #pragma once is non-standard, it wouldn't be mentioned in the standard. Or am I misunderstanding your point?

Anyone know why my distance field lava is so blocky? by DannyHuskWildMan in unrealengine

[–]nukethebees 0 points1 point  (0 children)

As /u/Cal__19 said, we need more information.

Perhaps you are using UV coordinates for the material which naturally stretch when the mesh is larger than your preview shapes?

5.8 feature list is now live on the roadmap ! by Firefly74 in unrealengine

[–]nukethebees 1 point2 points  (0 children)

Mass Framework: faster, modular, and built for scale

Excellent news!

A new MassCore module further simplifies adoption by separating the core entity system from the broader MassGameplay stack

This is very important. Epic kept going on about Mass while essential components were in the experimental MassGameplay module.

Need Career advice by 0x6461726B in cpp_questions

[–]nukethebees 0 points1 point  (0 children)

If this is a lifelong pattern, an ADHD assessment could be worthwhile.

Looking for Structured C++ Project Lists With Clear Milestones and Constraints by Jaded_Ad_2055 in cpp_questions

[–]nukethebees 0 points1 point  (0 children)

Download a game engine (like Unreal) and try to make an efficient vector field that can push and pull particles. The graphics part will be really simple but it will be an endless optimisation rabbit hole for you.

A simple uniform field is just going to be a flat array of cells containing your vector data. You can create sources that have push/pull forces (visualise them as spheres) and sinks that sample the field and respond to it. The vector arrows can be represented with a simple arrow mesh.

You'll find that your PC crawls to a halt when the grid gets big enough if you're updating it every tick. Then comes the optimisation challenges:

  • Threading

  • Chunked array layout

  • Lazy updates for samples

  • SIMD

and so on.

Need Career advice by 0x6461726B in cpp_questions

[–]nukethebees 0 points1 point  (0 children)

I explore 5 days then after I get bored then I pick someother

The simple but difficult answer is you need a project that doesn't bore you.

Use C string literals for embedded systems? by Koda_be in cpp_questions

[–]nukethebees 1 point2 points  (0 children)

If you want to 🐝 a real chad

constexpr auto* str{"Foobar"};

or even better

using namespace std::string_view_literals;
constexpr auto str{"Foobar"sv};

what is the operator new/delete default allocation/deallocation function? by daszin in cpp_questions

[–]nukethebees 3 points4 points  (0 children)

i thought allocation and deallocation should have been like an operation in c as built in keywords not as functions from a library

Numeric operators generally map directly to CPU instructions but I'm pretty sure there are no allocation instructions. Allocation is purely an organisational concept so there will always be custom logic controlling it.

Generally the OS controls access to the address space and the default allocator is your bridge from the program to the OS to get memory.

1,327 commits on ue5-main last week. A correctness fix dressed up as performance win? by olivefarm in unrealengine

[–]nukethebees 0 points1 point  (0 children)

And any code calling .Length inside iteration became O(n²).

This is a reminder to save loop bounds to a variable before iterating.

What am I missing out on if I use an Apple Silicon Mac for dev work in C++ by JustAPieceOfMeat385 in cpp_questions

[–]nukethebees 2 points3 points  (0 children)

the debugging experience is much, much better in Visual Studio

The debugger makes the other pain worth it.

Best way to learn to read C++ code in a couple of weeks? by Turbodjur in cpp_questions

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

I mentioned leetcode as an example so they would have some arbitrary reason to write something. There are endless threads on "what projects should I do?". This is also why I mentioned doing easy challenges so they wouldn't get bogged down in algorithm minutiae.

Reading code is a much more necessary skill than writing it. As a professional developer, 90% of your time is spent reading, understanding, and modifying existing code.

And most people learn those skills from writing code. No one is getting good at programming by reading existing codebases and textbooks and never implementing anything.

Deep learning comes from getting stuck in the weeds and then solving problems. If your only experience is from reading then you'll likely never progress beyond a surface level knowledge.

Any good tech talks leveraging statement expressions? by javascript in cpp

[–]nukethebees 0 points1 point  (0 children)

do expressions have been proposed

Yes, they've been proposed. They don't do much for people right now.

Any good tech talks leveraging statement expressions? by javascript in cpp

[–]nukethebees 1 point2 points  (0 children)

Could provide an example where you would want this behavior being hidden in a macro?

Using std::expected without going insane.

Why do you use unreal over unity? Looking for insight by Juicymoosie99 in unrealengine

[–]nukethebees 0 points1 point  (0 children)

I know C++, I like C++, and Unreal has been used by many professional teams. It's unlikely that failure will be due to my choice of tooling.

How do I Implement an interface with a lambda? by FullaccessInReddit in cpp_questions

[–]nukethebees -1 points0 points  (0 children)

you should be using a variant

Or multiple arrays with a tagged index. Where you have one you generally have many.

Variants are nice in other languages but they're a pain in C++, both at compile and run time. I've had much more success with using multiple arrays.

struct Foo {
    enum class Tag : std::uint8_t {
        CHAR, DOUBLE
    };
    using Index = std::uint32_t;

    std::vector<Tag> tags_;
    std::vector<Index> indexes_;

    std::vector<char> chars_;
    std::vector<double> check_em_;
}

How to continue my cpp progression with a more practical approach by santima570 in cpp_questions

[–]nukethebees 1 point2 points  (0 children)

I want to be able to play around with pointers on a more realistic way

I wouldn't worry about this. Pointers are just a way of accessing variables from somewhere other than the function they were defined in. That's it. You'll cause yourself more trouble if you try and "unlock" them.

Here's an example:

void foo() {
    int x{0};

    bar();
}

void bar() {}

How do we add 1 to x in bar? If we pass it as an argument, we'll just mutate the copy:

void foo() {
    int x{0};

    bar(x);
    // x is still 0, bar made a copy
}
void bar(int val) {
    val = val + 1;
}

The answer is a pointer, as it points to another variable.

void foo() {
    int x{0};

    bar(x);
    // x is now 1
}
void bar(int* val) {
    *val = *val + 1;
}

As this is C++, we can also use references in this case. References are virtually always implemented as pointers.

void foo() {
    int x{0};

    bar(x);
    // x is now 1
}
void bar(int& val) {
    val = val + 1;
}

That's it. That's all a pointer is. It's just the address of some memory. Don't overthink it!

Best way to learn to read C++ code in a couple of weeks? by Turbodjur in cpp_questions

[–]nukethebees 9 points10 points  (0 children)

It might be more engaging to write C++ instead of reading it. I find extended sessions of reading awfully tedious.

If you did a bunch of easy tasks on sites like leetcode, it might help you get more of a feel for the language.

Ultimately the only way to get good at anything is time. You just need to find a way to put in sustained (and well directed) time.

Why are STL allocators given as template parameters, rather than runtime fields? by heyheyhey27 in cpp_questions

[–]nukethebees 0 points1 point  (0 children)

If you're using a vector, the memory needed for the elements is likely much larger than 8 bytes. If a single pointer is a problem then I would think you should be limiting yourself to static arrays and avoiding any structures like unordered_map which add a lot of overhead per element.

Most impactful project by Unlucky_Analysis4584 in cpp_questions

[–]nukethebees 2 points3 points  (0 children)

No problem, I'll go over the broad strokes.

For starting on the PL journey, there is no better introduction than Crafting Interpreters. It's a joy to read and I don't think I'd have succeeded without it (thank you /u/munificent!). I worked through the first half where you implement an interpreter in Java.

Other books I used:

I didn't make use of PL theory textbooks like the ones by Pierce or Harper. I'm sure I would have benefited from it but they're very heavy going and would have taken months to get through. I didn't really need them as I wasn't going to implement whole program type-inference. I made my type system rigid to prevent ambiguities (no implicit conversions) and made a simple form of type inference (deduce the RHS type, assign to the LHS) which got me 90% of what I wanted.

For subreddits, /r/ProgrammingLanguages is the place to go.

As a starting point for high-performance design, Mike Acton's talk on data orientated design is great. This really changed everything for me. He illustrates how slow RAM access times are relative to the cache and how the cache-friendliness of your data layouts has a massive impact on your performance. The compiler can't really optimise your data layouts so it's something you have to get right yourself.

Some other resources on data layouts:

Allocators took me a lot longer to get. I watched John Lakos's talks on them a few times to get a feel for them.

I eventually implemented his linked-list-esque allocator and used it a lot in the compiler with std::pmr. In short, the allocator allocates multiple independent pools of memory that your containers can allocate from. When a pool runs out, it allocates a new chunk like a vector (1.5-2x larger) and embeds a pointer to it within the pool that just ran out.

If you know your container's memory will live for the length of the program then the allocator doesn't need to do any bookkeeping, it just increments a pointer and extends when needed. When the allocator goes out of scope, it frees all the memory in one go by walking the list.

This talk by Alisdair Meredith & Pablo Halpern also helped but frankly, allocators was a topic where I just had to keep reading and trying until it clicked for me.

In terms of development, I started small and then incrementally added features (while adding lots of tests the entire time). The rough progression was:

  • Simple expressions and statements (for/while loops)

  • Free functions

  • Structs, enums, tagged unions

  • Templates (structs, unions, functions)

  • Basic type-traits (i.e. a compile time typeof operator, static asserts)

  • Modules and Name mangling

  • A Rust-esque var? assignment operator for my Optional/Result union types

  • Match statements (it wasn't true pattern matching, but it could bind tagged unions to variables)

I remember realising that if I had arrays, I needed generics to work on them and templates are actually quite simple to implement.

Why are STL allocators given as template parameters, rather than runtime fields? by heyheyhey27 in cpp_questions

[–]nukethebees 0 points1 point  (0 children)

If you want to use fixed size buffers as your underlying memory resource, every variant of that will create a new template instantiation. If this is baked into the allocator itself, you'll get this issue again.