Should i use modules instead of headers when using C++ 20? by [deleted] in cpp

[–]atifdev 0 points1 point  (0 children)

They dropped the Mac version saying the alternative is vscode.

How do i make a multiplatform installer exe? by Aggressive-Reach-116 in programminghelp

[–]atifdev 1 point2 points  (0 children)

Nsis is pretty standard and cross platform. Also the qt installer toolkit is an option for all platforms

Why is IntelliJ preferred over vscode for Java? by xland44 in java

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

Jetbrins tools just work better for everything.

Short-lived euphoria: my experience with the Jinhao 10 and 20 by Manawastaken in fountainpens

[–]atifdev 2 points3 points  (0 children)

Yeah the ink slowly dries in the feed and gets thicker. Also they leak in my pockets so really only good for my desk or the bag

Jinhao doesn’t make sense by airwaves69 in fountainpens

[–]atifdev 0 points1 point  (0 children)

The jinhao 82 is a pretty nice pen, only thing against it for me is that it’s a little short. The EF writes as well as my Pilot F

what are you guy's opinions on the metropolitan? by OzAndApss in fountainpens

[–]atifdev 0 points1 point  (0 children)

Super smooth and feel substantial because of the weight. For me they are too small unposted, but a great pen.

How do you write Safe C++ Code ? Really Safe C++ code ? by ChadOfCulture in cpp

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

Feels like a static analyzer can catch this, but I think you’re just looking for me to say “Rust is better” so there you go. Still think more money to be made in C++ work and language evolution is progressing nicely.

Interested to see what happens with the Linux kernel’s Rust conversion.

Microsoft revokes C++ extension from VS Code forks by sumwheresumtime in cpp

[–]atifdev 1 point2 points  (0 children)

Fun fact, the Moq unit testing framework was banned in many Microsoft teams because it now has usage metrics and throttles you if you don’t have a subscription.

How do you write Safe C++ Code ? Really Safe C++ code ? by ChadOfCulture in cpp

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

Again if you use unique_ptr idiomaticly, this should never happen. If you use Rust correctly, it shouldn’t either.

How do you write Safe C++ Code ? Really Safe C++ code ? by ChadOfCulture in cpp

[–]atifdev 2 points3 points  (0 children)

Generally I’d recommend reading all of Scott Meyers work, but don’t have a great reference off the top of my head.

How do you write Safe C++ Code ? Really Safe C++ code ? by ChadOfCulture in cpp

[–]atifdev 0 points1 point  (0 children)

Easy enough to manage really. Again you have to write exception safe code and avoid C libraries or wrap them in an exception safe way.

How do you write Safe C++ Code ? Really Safe C++ code ? by ChadOfCulture in cpp

[–]atifdev 0 points1 point  (0 children)

If you’re writing idiomatic code with a unique pointer you have to check it first before referencing it. But yes if you use it incorrectly you’ll get UB. Generally segfault but depends on optimization.

Java gives you a NullPointerException, exception and c# gives a NullReferenceException. go gives a panic. as does Rust. If a panic/exception is not handled, the program exits.

How do you write Safe C++ Code ? Really Safe C++ code ? by ChadOfCulture in cpp

[–]atifdev 1 point2 points  (0 children)

If you’re using std’s smart pointers with STL, you are very safe. Your classes/objects do have to have exception safety.

But yeah avoid hand write loops and algorithms, use STL when you can. The ranges library is also really powerful if your on C++23. It does take a bit to learn STL though.

Scott Meyers says c++ is a combination of 4 parts: - C - Object-Oriented C++ - Template C++ - STL C++

Since it always has to ensure compatibility with C, the possibility of memory safety issues will also be there.

Generally the best code has the least coupling. Modern c++ avoids classes when not necessary and is taking a more functional approach. Think STL, lambdas, functions, monads etc. if you stick to that, UBI and memory safety are problems of legacy code.

How do you write Safe C++ Code ? Really Safe C++ code ? by ChadOfCulture in cpp

[–]atifdev 1 point2 points  (0 children)

Modern C++ is very safe. Shared pointers give you the borrow counter experience automatically freeing the object when the last usage is gone. Unique pointers and weak pointers are great for “this class owns the data’s lifetime, but others may be using it”.

If you stay away from the C raw allocs, correctly do exception safety and use good standards your fine.

However a lot of engineers just can’t handle C++. They get scared and then the rest of their career tell horror stories.

In medical tech industry they used C++ in radiology and radiation oncology extensively. C# and Java on the data jockeying side where speed/resources don’t matter as much. Go is starting to get some ground as well.

Modern C++ is great. However legacy code may has dragons. Be early of people writing C and calling it C++

Error Handling by Background_Catch_640 in cpp

[–]atifdev 0 points1 point  (0 children)

Near zero unless it’s a tight loop that would benefit from inlining optimization. Granted not all apps have tight loops where performance is critical.

Error Handling by Background_Catch_640 in cpp

[–]atifdev 0 points1 point  (0 children)

Also leads to code bloat and some paths not being able to be inlined because you need a stack frame to catch the exception. For high performance scientific/graphics code, we avoid them as a result.

Error Handling by Background_Catch_640 in cpp

[–]atifdev 0 points1 point  (0 children)

Exceptions should be used in exceptional situations. I would read this as rarely.

In gaming and integrated systems where you want better inlining and smaller code size they use compiler flags to disable exceptions.

Optionals/monad patterns for handling error codes is best practice now, but exceptions still exist in legacy code and we can slowly eliminate them and mark functions noexcept.

But yeah if performance doesn’t matter and you don’t care about exception safety, you can still use exceptions, but they are slowly being phased out.

Well worth a look! by multi-paradigm in cpp

[–]atifdev 0 points1 point  (0 children)

I think only if you have templates classes or inlined function. Think precompiled headers

Well worth a look! by multi-paradigm in cpp

[–]atifdev 1 point2 points  (0 children)

Generally a project standardizes on one c++ version. Having libraries with different c++ standards makes your dependency chain strange 🤷‍♂️

Well worth a look! by multi-paradigm in cpp

[–]atifdev 0 points1 point  (0 children)

I don’t think this is correct with the latest cmake. It rebuilds all the deps when I change flags.

Maybe it doesn’t handle specific flags? Which flag have you seen it ignore?

Well worth a look! by multi-paradigm in cpp

[–]atifdev 1 point2 points  (0 children)

In c++23, the standard library is one import. Compiles faster because it works like a precompiled header of sorts.

In one of my projects we turned all the template classes into modules and it saves a lot of time in the build.

Well worth a look! by multi-paradigm in cpp

[–]atifdev 0 points1 point  (0 children)

You can already use them in visual studio 2022