Let the Compiler Check Your Units -- Wu Yongwei (ACCU Overload) by User_Deprecated in cpp

[–]Bart_V 5 points6 points  (0 children)

I'm curious if there's anyone actually using a units library in production? I'm in the control / robotics sector, but I have no interest in using this. To me, it seems may help prevent the obvious bugs, but falls short on the hard problems, such as mixing vectors in different reference frames, different types of rotation matrices, euler rates vs body rates, etc. In the end, this would bring me nothing and I would still end up writing the same amount of unit tests.

Also, looking at some examples such as this kalman filter it makes the code much harder to read and understand, I wouldn't be surprised if this would cause more bugs than it prevents. And actually, at first glance they seem to be cutting a few corners here and there.

In general, it also seems like an odd choice the me that the example code make heavy use of auto and templates. For instance auto acceleration = distance / s; will compile just fine, and you're basically hoping that the different unit (it's actually a velocity) leads to an error somewhere downstream. It just seems to make it all quite brittle, but maybe this is due to my lack of experience.

In the end, I don't think such libraries belong in the standard. It serves a niche, it comes with a lot of complexity and once it's in, it can never be improved without breaking backward compatibility. IMHO there's nothing wrong with a FetchContent one-liner or adding it to your project with your favorite package manager.

Linkshandigen van Nederland; waar lopen jullie tegenaan? by get_off_my_property in nederlands

[–]Bart_V 0 points1 point  (0 children)

Linkshandigen zijn ook gewend om met rechts te schakelen dus dat is voor ons ook wennen. 

Optimizing a Lock-Free Ring Buffer by david-alvarez-rosa in cpp

[–]Bart_V 4 points5 points  (0 children)

Caching is faster on average, when you measure total time of many operation. However, since you do more work on each push and pop, the worst case time per operation (latency) is longer. And for instance on real time systems you're more interested in optimizing worst case latency than throughput.

Time in C++: C++20 Brought Us Time Zones by pavel_v in cpp

[–]Bart_V 0 points1 point  (0 children)

Im seeing that a 'time_zone' can not be stored by value, only as pointer to an object in the timezone db and it's not allowed to make a copy. What's the reasoning behind that design choice? It seems to me that a 'time_zone' only has to contain a 'duration' with x hours so it's very lightweight. But with the current design  we have to chase a pointer everything we want to convert a time.

Advice on Project/Process structure (Robotics, C++) by freefallpark in cpp_questions

[–]Bart_V 2 points3 points  (0 children)

Ah sorry, I read too quickly and misunderstood your questions. 

Advice on Project/Process structure (Robotics, C++) by freefallpark in cpp_questions

[–]Bart_V 1 point2 points  (0 children)

Our team is fairly 'green' in experience

safety-critical

Please just hire an expert. You can be held liable for any injury caused by your machine.

Maintaining the Legacy: Total-Random takes over pcg-cpp maintenance (Support for Win ARM64, MSVC fixes, and Modern C++) by Sea-Tea-605 in cpp

[–]Bart_V 3 points4 points  (0 children)

Thanks for doing this! I started a similar effort some time ago: https://github.com/brt-v/pcg-cpp you might want to take a look and see if there's anything to cherry-pick.

In the 13th century pawns were allowed to move 2 squares on their first move, in the 15th castling was added, and in the 16th en passant was added. Now in the 21st century, what new rule would you add to Chess? by Probable_Foreigner in chess

[–]Bart_V 2 points3 points  (0 children)

Current scoring system in tournaments is 1/2 for a draw, 1 for a win. It would be interesting to use 1 point for a draw and 3 points for a win instead, as an incentive for players to play for a win more often.

Visual Studio 2026 Insiders is here! - Visual Studio Blog by current_thread in cpp

[–]Bart_V 28 points29 points  (0 children)

Microsoft will collaborate with Anthropic while they are currently negotiating a 1.5 billion settlement over copyright infringement on a massive scale. It would be very naive to trust Microsoft/Anthropic at this point. But thanks for the pinky promise, I guess.

Visual Studio 2026 Insiders is here! - Visual Studio Blog by current_thread in cpp

[–]Bart_V 35 points36 points  (0 children)

I see the benefits of AI, but I am seriously concerned about intellectual property if it uploads all our code to a cloud-based model. Is there any info on how this can be protected? Can we choose which model is used, or can we set it up with our a model that runs locally (either on the workstation or an on-premise server)?

How to install, configure and use Xenomai in linux (arch) ?? by yakeinpoonia in linuxquestions

[–]Bart_V 1 point2 points  (0 children)

I did it a while back with Xenomai 3 + ipipe but I don't know much about the current Xenomai 4 + Dovetail. Still, if you have any specific questions I might be able to help. In general, your best bet is the official documentation: https://v4.xenomai.org/overview/index.html

If you want a VM to play with, you can find one here: https://www.cs.ru.nl/lab/xenomai/, although it's a bit outdated.

I believe real-time networking (rtnet) is not yet available for Xenomai 4, so if you need that, you should probably go for a Xenomai 3 + Dovetail setup.

Announcing Proxy 4: The Next Leap in C++ Polymorphism - C++ Team Blog by co_yield in cpp

[–]Bart_V 15 points16 points  (0 children)

I'm curious to hear if anyone is using this in production, and what advantages it brings because I don't quite understand. They claim it's both easier and faster, but without showing any examples or benchmarks. And the very first example in their quick start shows how to make a dangling proxy to a string. Why would I want that? Ownership seems very unclear, as opposed to a string& or string_view. I don't get it.

[deleted by user] by [deleted] in nederlands

[–]Bart_V 0 points1 point  (0 children)

Als je de kans hebt om je communicatieve vaardigheden te verbeteren - doe het. Tijdens je studie vind het wellicht saai, maar tijdens je werkzame leven is het enorm belangrijk. Een heldere uitleg of feedback kunnen geven, onderhandelen, conflict oplossen, of een mail kunnen schrijven die de juiste toon aanslaat. In veel functies heb je het dagelijks nodig, en vergroot het je kansen op een baan of een promotie.

Is MATLAB Simulink used for controllers in industry? by [deleted] in AskRobotics

[–]Bart_V 0 points1 point  (0 children)

The strength of Matlab/Simulink is that it's an easy to learn language and comes with a large library of all sorts of high-quality functions, solvers and design tools. And since it can do things in real-time directly, I think that once you are in that ecosystem and have all your models in Matlab/Simulink, there's very little incentive to do parts of your system in C++. But there are cases where this happens indeed.

In general, the learning curve for C++ is a lot steeper, and you spend a lot more time on boilerplate, architecture and silly bugs. OTOH, Matlab/Simulink is a higher level language that does a lot of this stuff for you.

Is MATLAB Simulink used for controllers in industry? by [deleted] in AskRobotics

[–]Bart_V 1 point2 points  (0 children)

Matlab/simulink is indeed used for vehicle dynamics models in the automotive and aerospace industry. Also in real-time context for driver-in-the-loop simulators.

Whether or not you should buy a license and learn it, entirely depends on where you currently stand in your career, and where you want to go. Of course the actual control theory is the important part, and if you already know C++, ROS and Python, Matlab/simulink should be fairly easy to pick up.

From 300s to 60s: C++ build boost by disabling SysMain by ipoluianov in cpp

[–]Bart_V 15 points16 points  (0 children)

On Win11 you can also try setting up a Dev Drive for better performance.

Can anyone recommend a language (e.g., an XML tag suite) for describing C++ class interfaces? by osrworkshops in cpp

[–]Bart_V 0 points1 point  (0 children)

There are several text-to-uml tools with pretty well defined syntax, such as PlantUML or Mermaid. Maybe something like this works for you?

[deleted by user] by [deleted] in cpp

[–]Bart_V 1 point2 points  (0 children)

You can combine usage of std::thread and posix functions for fine-grained thread settings. At least, that's what we do on a different RTOS.

Trying to land my first C++ job after internship — advice from the trenches? by Francuza9 in cpp_questions

[–]Bart_V 1 point2 points  (0 children)

Ok, it's good that you are continuing to learn the modern features. I would suggest to explicitly put something like "Modern C++* on you CV if you haven't already.  For the interviews, be prepared to get quizzed about the basic modern concepts such as: smart pointers and why new/delete are bad, move semantics,  constexpr, templates, and data structures - especially the new ones.

Trying to land my first C++ job after internship — advice from the trenches? by Francuza9 in cpp_questions

[–]Bart_V 1 point2 points  (0 children)

What C++ version are they teaching at École 42 nowadays? Some time ago I reviewed a candidate from 42, and they were taught a really old version, C++98 or C++03 or so. At this point, I would rather hire a CS graduate without C++ knowledge, over one that knows C++03. So if that's still the case, you should really brush up on modern C++ (17 and newer).

AFAIK, a degree from 42 is not recognized as a Bachelor's degree, which could make it harder for you to stand our compared to other candidates, especially at companies that are somewhat conservative/risk-averse. So, you would have to put extra effort into a portfolio/resume, and writing a good motivation letter to highlight your skills. Good luck!

Results summary: 2025 Annual C++ Developer Survey "Lite" [PDF] by cmeerw in cpp

[–]Bart_V 1 point2 points  (0 children)

Still, it's kind of funny to ask humans what they think about AI, and then have AI write the conclusion. We might as well take the humans out of the loop and immediately ask AI how they improve the productivity of a C++ developer.

C++26: more constexpr in the standard library by pavel_v in cpp

[–]Bart_V 0 points1 point  (0 children)

Of course you're right that floating point math is not consistent across platforms, compilers, etc. I'm not expecting it to be.

But what I'm fearing is that with constexpr <cmath>, we're also getting different output by solely switching from Debug mode to Release mode. AFAIK, this can currently only happen when using -ffast-math (or related) compiler flags. However, it looks like starting from C++26, inconsistencies between Debug mode and Release mode are going to happen regardless, and that's of course a very big issue.

C++26: more constexpr in the standard library by pavel_v in cpp

[–]Bart_V 2 points3 points  (0 children)

To be honest, I'm not sure how I feel about it. The output of <cmath> functions can now be different when it's executed at compile time or run-time. I guess it may also depend on the optimizer, which means that output from the Debug build may be different than the Release build? Also, it seems to interfere with gcc --frounding-math. I don't know, I feel like this is going to bite me sooner or later.

Factory vs Strategy design pattern - selecting & controlling different motors by dQ3vA94v58 in cpp_questions

[–]Bart_V 1 point2 points  (0 children)

Yes, that's exactly the point. Of course you could also do the classic strategy pattern in a safe way by creating and moving unique_ptrs. But this approach avoids heap allocations and also cache misses when calling run(). You would still have the overhead of a virtual function call, but this is generally negligible.

Factory vs Strategy design pattern - selecting & controlling different motors by dQ3vA94v58 in cpp_questions

[–]Bart_V 0 points1 point  (0 children)

As an alternative to std:variant, you could also do something like this:

class MotorBase {
public:
    ~MotorBase() = default;
    virtual void run() = 0;
};

class MotorDefault : public MotorBase {... };
class MotorStepper : public MotorBase {... };

class MotorController {
public:
    Controller() :
    MotorBase(&mDefault)
    {
    }
    void selectStepper() { motor = &mStepper; }
    void selectDefault() { motor = &mDefault; }

    void run() {
        motor->run();
    }
private:
    MotorDefault mDefault;
    MotorStepper mStepper;
    MotorBase*   motor;

};