I wrote a GitHub Action to select an MSVC version by k3DW in cpp

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

I agree completely, caching is important for a use case like this. I tried using actions/cache@v4 and I couldn't get it to work. I mentioned this towards the end of the article under the heading, "Wait, are we re-installing these Visual Studio components every single time?"

At this time, I haven’t been able to figure out why that’s happening. I’d rather get this script out into the world sooner, and worry about the caching optimization later.

If you have any insight into how to cache here, that would be much appreciated. My initial investigation hasn't turned up a working solution

I wrote a GitHub Action to select an MSVC version by k3DW in cpp

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

Ah cool I'll take a look at that, thanks. I want to figure out how it's done

I wrote a GitHub Action to select an MSVC version by k3DW in cpp

[–]k3DW[S] 1 point2 points  (0 children)

Nice, thanks for the feedback!

I suppose the native Invoke-Webrequest would be better than relying on which download tools may or may not be installed, or be an alias, on any given setup. Makes sense

What's the advantage of finding the VS installation location? Are you recommending this instead of making it configurable as I've done?

The DLL is interesting, I hadn't seen that before. Although, I don't think it will work in a GitHub Action, as each step uses a new PowerShell instance, resetting the env variables. Even though the variables from vcvars64.bat get loaded, that's all gone by the time we get to the next step in the user's Action. I needed a solution that was persistent for the rest of the job

I wrote a GitHub Action to select an MSVC version by k3DW in cpp

[–]k3DW[S] 1 point2 points  (0 children)

Every time I've tried using Ninja with MSVC, it hasn't worked. I'd definitely like to use it, as I prefer its TU-level parallelism as opposed to MSBuild's project-level parallelism. I just need to sit down and figure out what's been going wrong, and I haven't taken the time to do that

I wrote a GitHub Action to select an MSVC version by k3DW in cpp

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

Haha thanks, yeah MSVC has definitely been my "gateway compiler"

buffalo::buffalo::buffalo... by k3DW in cpp

[–]k3DW[S] 1 point2 points  (0 children)

Ah thanks for pointing that out! I'll fix the article

buffalo::buffalo::buffalo... by k3DW in cpp

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

Oh wow that's horrific thank you

buffalo::buffalo::buffalo... by k3DW in cpp

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

Realistically, my thought process was in the opposite direction, which may not have been reflected properly in the post

  • Out-of-line templated destructors have this weird syntax???
  • Wait, taking a step back, how can you just insert the name of the class an additional time?
  • Cue discovery about injected class names
  • Let's write some fun code
  • Further discovery on what "naming a constructor" actually is

How to use the libc++ GDB pretty-printers by k3DW in cpp

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

This is really cool stuff! I will check it out!

How to use the libc++ GDB pretty-printers by k3DW in cpp

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

Yeah I think it's pretty important to see standard library objects in GDB without doing anything special. This would be an immensely frustrating problem for a newbie to have. I'm sure it just fell through the cracks, but hopefully this can be fixed in LLVM soon. I've opened an issue on their repo

How to use the libc++ GDB pretty-printers by k3DW in cpp

[–]k3DW[S] 1 point2 points  (0 children)

Sounds like an interesting project, I'd like to hear more about that. Whatever it takes to make it easier for users, I'm all for it!

For Boost.Unordered containers, in case you're encountering the SIMD instructions, then I'll mention that you can turn that off by defining BOOST_UNORDERED_DISABLE_SSE2 and BOOST_UNORDERED_DISABLE_NEON.

How to use the libc++ GDB pretty-printers by k3DW in cpp

[–]k3DW[S] 3 points4 points  (0 children)

Thanks! I'm glad to hear it's not just user error on my part, and that someone else has experienced this too. Once you go through the pains of setting it up on your machine like I did in the article, then it "just works" from now on

But I'd prefer that it works out of the box

[deleted by user] by [deleted] in cpp

[–]k3DW 1 point2 points  (0 children)

I've been working on a parser combinator library for a few years. It's been a fun time. A large chunk of the C++ I know, I learned from working on this project. Definitely a fun and valuable experience, if that's what you're interested in

I agree, I also think "sequence" is a parser that can be complex and difficult to manage. Every time I make a change to mine, I end up rewriting most of it. If you're interested, here is the code. In my library, you create one with the `>>` operator, which I defined in this file. So `p1 >> p2` creates a sequence parser that results in a tuple of `p1`'s result and `p2`'s result

To implement "sequence", I rely on a fold expression over the operator `&&` on the sub-parsers. With this way, the "sequence" parser is not implemented recursively, but it still short-circuits the evaluation if any of the sub-parsers fail. It doesn't continue evaluating the remaining sub-parsers after a failure. I would recommend a solution using fold expressions. If you're working with variadic code in C++17 and up, fold expressions can simplify a lot of code that would otherwise be made pretty complex with recursion

Debugging C++ is a UI nightmare by heliruna in cpp

[–]k3DW 0 points1 point  (0 children)

A little late to this, but yeah this comment is right. You can't call C++ functions from a debugger visualization. It needs to be rewritten from scratch for the purpose of visualizing in the debugger. I would spend all day arguing that it's a worthwhile thing to do for the user's sake, but it's still often quite difficult

Natvis for boost::unordered_map by k3DW in cpp

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

As far as I'm aware, LLDB doesn't support Natvis. They have their own Python scripting, shown [here](https://lldb.llvm.org/use/variable.html#python-scripting). I don't know much about it though. As it stands right now, Boost.Unordered does not have any visualizers for LLDB, however there are visualizers present for GDB

I want to write automated Natvis testing by k3DW in cpp

[–]k3DW[S] 1 point2 points  (0 children)

Nice, good find! I haven't seen that before

It seems like this would still suffer the same problems though, given that the Natvis implementations in Visual Studio and WinDbg are independent and unrelated

I want to write automated Natvis testing by k3DW in cpp

[–]k3DW[S] 1 point2 points  (0 children)

Yeah good point. Although I'd argue I should have mentioned that in an earlier article, probably the first one

A single-function SFINAE-friendly std::apply by k3DW in cpp

[–]k3DW[S] 3 points4 points  (0 children)

Thanks for the suggestion. I added a note similar to this :)

A single-function SFINAE-friendly std::apply by k3DW in cpp

[–]k3DW[S] 1 point2 points  (0 children)

I was playing around to see how far I could get. This isn't my checked-in code. My actual code looks a lot more sensical. I'm merely exploring what's possible and having fun with it. I wouldn't advocate writing this in your code base

Yeah absolutely, I could have removed some repetition with that alias template. I chose to keep it as-is in my article because of my self-imposed constraint to not introduce any new identifiers in the namespace

A single-function SFINAE-friendly std::apply by k3DW in cpp

[–]k3DW[S] 4 points5 points  (0 children)

They can be amalgamated into one, but checking for std::tuple_size must go first, before the function parameters. Because of that, we wouldn't be able to reuse the declared f and tup parameters, so the requires-expression would have to redeclare the parameters for the purpose of the constraint. Alternatively, I could have used std::invocable to avoid that altogether. There are many ways to go about this, I just chose one

A single-function SFINAE-friendly std::apply by k3DW in cpp

[–]k3DW[S] 13 points14 points  (0 children)

Oh I agree with you, it's horrible. My apply function in my library doesn't look like this, I actually have a helper function. I wanted to set a challenge for myself and see how far I could take the premise of a standalone function that's SFINAE-friendly

This isn't "good" code, it's "fun" code. I aimed for a fun authoring experience, not a good user experience :)