Need to comply with MISRA® C++:2023? Get an introduction to the latest version of the standard in the first of a blog series: https://ter.li/p757iw
Perforce Software’s Post
More Relevant Posts
-
C++ is powerful, but modern C++ can be very overwhelming... This article on refactoring legacy code (see link below) shows how a Circle class with just a constructor, a pi member, and a few functions, clean, readable, and easy to understand can be turned into a complicated, difficult to read Circle class containing a massive amount of modern C++ features like constexpr, explicit, auto, inline, templates, type traits, rvalue references, noexcept, and user-defined literals. I follow every decision made and I do understand that the Circle is technically improved, but if feels bloated and complex. How can we balance simplicity with the features of modern C++, or is it possible to achieve both? https://lnkd.in/ePKsNCVB #cprogramming #moderncpp #keepitsimple
To view or add a comment, sign in
-
I think a big issue is the overuse of OOP principles as a solution to all problems. Many a time if I have seen code bases where abstraction and encapsulating even the most minute of things are everywhere, making implementation and maintenance a nightmare. I like John Carmack's statement that he uses "C-flavored C++", which was sort of the whole point of C++ being thought of as "C with classes". I personally as well as others I have worked with, have had success following a few principles that attempt to use the best (and avoid the worst) of both: Use classes only when appropriate, avoid inheritance if possible, avoid polymorphism if possible, lean on STL to handle common data structures and operations on them (e.g., <vector> and <algorithm>, and judicious use of references over pointers. To go against any of the above, or use additional features, a REALLY good reason was needed. All of the new stuff like smart pointers, constexpr, lambdas, etc. is more fluff and adds bloat, along with the accompanying headaches. Then again, my field of work has biased my view on how C++ should be used.
C++ is powerful, but modern C++ can be very overwhelming... This article on refactoring legacy code (see link below) shows how a Circle class with just a constructor, a pi member, and a few functions, clean, readable, and easy to understand can be turned into a complicated, difficult to read Circle class containing a massive amount of modern C++ features like constexpr, explicit, auto, inline, templates, type traits, rvalue references, noexcept, and user-defined literals. I follow every decision made and I do understand that the Circle is technically improved, but if feels bloated and complex. How can we balance simplicity with the features of modern C++, or is it possible to achieve both? https://lnkd.in/ePKsNCVB #cprogramming #moderncpp #keepitsimple
To view or add a comment, sign in
-
Hey! I've just written an article on my personal webpage about how to construct a MISRA-C friendly static assertion predicate in C99 (with a little extra helpful macro at the bottom). You might find it very useful and/or informative! Go check it out:
MISRA-C friendly C99 static assert macro
riccardobelli.it
To view or add a comment, sign in
-
Enum class improvements for C++17, C++20 and C++23 https://lnkd.in/eiD7c4DF #cpp #cplusplus
Enum Class Improvements for C++17, C++20 and C++23
cppstories.com
To view or add a comment, sign in
-
Senior C++ Software Engineer | Algorithmic Trading Developer | Market Data | Exchange Connectivity | Trading Firm | High-Frequency Trading
The future of error handling in C++ 23: std::expected C++ 23 has finally arrived, bringing with it a host of exciting new features, including the much-anticipated std::expected library. This library offers a new way to handle errors in your C++ code, promising to make code safer, more readable, and more efficient. What is std::expected? std::expected is a template class that represents a value that may be present or absent. It is similar to std::optional, but with the crucial difference that it can also store an error value. This makes std::expected ideal for handling situations where an operation may fail for various reasons. Instead of using exceptions or returning error codes, you can simply use a std::expected to encapsulate the result of the operation and the error value, if any. Advantages of std::expected over throw: Increased safety: std::expected ensures that the code will always handle errors properly, avoiding unexpected failures. Better readability: Code using std::expected is easier to read and understand, as error handling is explicitly declared. Improved efficiency: std::expected can be more efficient than using exceptions, as it avoids the overhead of exception throwing and catching. Check out the example below: #CPP #C++23 #SoftwareDevelopment #Programming #Tech #exception #expected #error #handling
To view or add a comment, sign in
-
I have just enjoyed reading an article about how a RAFT consensus algorithm implementation might be simplified using C++20 coroutines. I spent around 20 minutes reading it. https://lnkd.in/dNKKfRjK #raft #cpp20 #asyncprogramming #tutorial
Implementation of the Raft Consensus Algorithm Using C++20 Coroutines - DZone
dzone.com
To view or add a comment, sign in
-
Excited to dive into the dynamic realm of C++ compilation efficiency! 🔍✨ In my latest Medium story, I unravel the intricacies of pre-compiled headers and the cutting-edge C++20 Modules. 💡⚙️ Discover how these tools reshape build times and empower developers. 🚀 Ready to optimize your C++ workflow? Read on! 👉 https://lnkd.in/d2xWb4UD #softwareengineering #cpp #cplusplus #cppprogramming #moderncpp #cpp20 #programming #softwaredevelopment #optimization #compiler
Unleashing C++ Compilation Efficiency: A Comprehensive Guide to Pre-Compiled Headers and C++20…
medium.com
To view or add a comment, sign in
-
Look into why C and C++ memory corruption is so difficult to find through code inspection. Find out how to use a memory error detection tool to assist and save you from all-night debugging sessions! #automatedsoftwaretesting
Memory Corruption Detection in C and C++ Through Code Inspection | Parasoft
parasoft.com
To view or add a comment, sign in
-
Navigating Memory in C++: A Guide to Using std::uintptr_t for Address Handling https://lnkd.in/eZdVXk9x #cpp #cplusplus
Navigating Memory in C++: A Guide to Using std::uintptr_t for Address Handling - Sticky Bits - Powered by Feabhas
blog.feabhas.com
To view or add a comment, sign in
-
#Day52 of #Codingchallenge: today's LeetCode Problem: Add Two Numbers. You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. Example 1: Input: l1 = [2,4,3], l2 = [5,6,4] Output: [7,0,8] Explanation: 342 + 465 = 807. Example 2: Input: l1 = [0], l2 = [0] Output: [0] Example 3: Input: l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9] Output: [8,9,9,9,0,0,0,1] #LeetCode #DSA #C ++.
To view or add a comment, sign in
29,678 followers