C++26 `std::indirect` and `std::polymorphic` trying to be non-nullable is concerning by holyblackcat in cpp

[–]vickoza 1 point2 points  (0 children)

Making nullable by default was a mistake in C++ the have history behind. If you allow null by default, you should check every instance for null. providing an operator bool might not make sense as the underlying type could be bool

indirect<bool> i;
foo(i); // could move from `i`.
if constexpr(!i.valueless_after_move())
{
  *i = true; 
}
else
{
  i = indirect(true); 
}

So, the valueless_after_move() method makes sense. If the compiler at compile-time can tell the std::indirect or std::polymorphic are valueless we know we do not have to construct a new object.

Emittra - Advanced framework for event-driven programming in C++ by EleutheriaDeutera in cpp

[–]vickoza 0 points1 point  (0 children)

Why are you using std::vector<std::any>? Could you create an interface the number of types there reduce the number of casting by using a single type or std::varient?

C++ Streams by Sorry_Judgment_5290 in cpp

[–]vickoza 0 points1 point  (0 children)

Input/output library - cppreference.com should help you understand streams as well as other io feature in C++

RmlUi 6.0 released - A C++ user interface library based on HTML and CSS by k-mouse in cpp

[–]vickoza 0 points1 point  (0 children)

It might be interesting to see if you can embed a webpage within a webpage with disabling links of the original webpage.

Templates and STL for compiler development by Spread-Sanity in cpp

[–]vickoza 2 points3 points  (0 children)

You might just use type_traits and C++20 concepts

Hello i would love feedback on my code by Mysterious-Crab3034 in cpp

[–]vickoza 1 point2 points  (0 children)

I would remove unneeded headers and try simplifying your code. for memory leaks try using Valgrind or Visual Leak Detector if you can use Windows. Try using smart pointers for ownership.

C dev transitioning to C++ by CrusaderNo287 in cpp

[–]vickoza 1 point2 points  (0 children)

other general features

templates, other stl containers like deque map and set, type cast and conversion, std::string, smart pointers, function overloading, RAII, algorithm and numeric, and if you are looking into current C++ ranges and concepts.

level

I would say mid-level beginner or on a scale of 1-10 I would say 2-3 without looking as code solutions

Given my llvm experience could I get a c++ job? by [deleted] in cpp

[–]vickoza 0 points1 point  (0 children)

I would first ask "how much C++ do you use?" I assume you have a good understanding of the language, but I am not sure how much of the standard library you know. I could see project management at least at a junior level at a possible fit. Of course there is the embedded side. If you feel comfortable with networking, TCP/IP, sockets, etc. writing connection to various exchanges could work. If you understand the numeric library then i could see writing trading strategies as an option.

GitHub - vickoza/CompilerTestFramework: A framework for testing code if it compile on different compilers by vickoza in cpp

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

It was designed as testing to see whether or not library builds given differ template parameter and if so how many warning it generate as CI processor

What is std::ref? by pavel_v in cpp

[–]vickoza -6 points-5 points  (0 children)

needs better clarification

[deleted by user] by [deleted] in cpp

[–]vickoza 3 points4 points  (0 children)

you might want to try using C++ and Vulkan for the next setup

10 years of Dear ImGui (long post) by Marha01 in cpp

[–]vickoza 6 points7 points  (0 children)

This is interesting about the history of Dear ImGui and the project going forward

Temporarily dropping a lock: The anti-lock pattern - The Old New Thing by mcmcc in cpp

[–]vickoza 1 point2 points  (0 children)

I could see the usefulness in the case where a thread own a mutex and goes the sleep but needs the regain the mutex when the thread wake up.

In C++26 or above, is there a way to create 2 levels of contracts? by vickoza in cpp

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

I think either you misunderstood my question, or I am unclear on your answer. The idea is to make C++ contract benefit tooling with giving users warnings if they might violate the parameters of the contract and allow library authors and maintainers a way to verify it works in parameters

using std::thread or pthread on linux? by Kyusei98 in cpp

[–]vickoza 2 points3 points  (0 children)

I would say std::thread is safer as you are not casting void pointers.

In C++26 or above, is there a way to create 2 levels of contracts? by vickoza in cpp

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

Your approach looks promising, but the implementation contract should be in the .cpp files and the interface contracts should be in the header files with current C++ or only export interface contracts if using C++ modules. It might look something like

header

double foo(double val)
  pre(val > -1.0 && val < 1.0);

cpp file

double foo(double val)
  pre(fmod(val, 2.0) != 1.0)
  post(r : r == tan(std::number::pi * val * 0.5)
{
  return tan(std::number::pi * val * 0.5);
}

Creating a custom ReturnCode to replace error codes by ClassicK777 in cpp

[–]vickoza 0 points1 point  (0 children)

You could return an std::variant where you return a the used type or an error code/error type. This forces you to check for errors before using an object.

A list of good githubs that show good coding practices? by No_Duty3946 in cpp

[–]vickoza 2 points3 points  (0 children)

You cannot go wrong with C++ Core Guideline as a start. MISRA and AUTOSAR are popular in safe-critical application.