- clang tooling library:
- AST matchers:
- extend
hasType
to work withTypedefDecl
nodes - add
functionProtoType
matcher for matchingFunctionProtoType
nodes - extend
parameterCountIs
matcher toFunctionProtoType
nodes
- extend
- AST matchers:
- clang-tidy checks:
modernize-macro-to-enum
converts groups of macros to unscoped anonymous enums
modernize-raw-string-literal
converts string literals with escaped characters to raw string literals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "type_traits.h" | |
#include <type_traits> | |
// In each test, replace XXX with syntax that passes the test. | |
BOOST_AUTO_TEST_CASE(is_void) | |
{ | |
BOOST_REQUIRE_EQUAL(true, std::is_void<XXX>::value); | |
std::is_void<XXX> val; | |
BOOST_REQUIRE_EQUAL(true, static_cast<bool>(val)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST( Foo, foo ) | |
{ | |
int failures = 0; | |
for (int i = 0; i < 50; ++i) { | |
EXPECT_TRUE( i % 2 == 0 ) << ([&failures]() { ++failures; return ""; })(); | |
} | |
if (failures > 0) { | |
std::cout << "There were " << failures << " failures.\n"; | |
} | |
} |
- Won't talk about preprocessor tricks
- Topic is very deep! To drill further, consult one or more of these books:
- 2001: Modern C++ Design: Generic Programming and Design Patterns Applied by Andrei Alexandrescu
- 2004: C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond by David Abrahams and Aleksey Gurtovoy
- 2017: C++ Templates: The Complete Guide (2nd Edition) by David Vandevoorde, Nicolai M. Josuttis, Douglas Gregor
- Template Review
- Template expansion
- Function Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constexpr auto jsv = R"({ | |
"feature-x-enabled": true, | |
"value-of-y": 1729, | |
"z-options": { | |
"a": null, | |
"b": "220 and 284", | |
"c": [ 6, 28, 496 ] | |
} | |
})"_json; |
- Characteristics of an embedded environment
- Bare metal interaction with hardware
- No operating system
- No virtual memory
- No C/C++ runtime
- No RTTI
- Our case study is the open source fractal generator Iterated Dynamics, a fork of FRACTINT.
- This is a 30 year old code base that started as a 16-bit MS-DOS program written in C and 16-bit x86 assembly.
- The code base has contributions from many, many authors over the years.
- Source formatting and identifier conventions are varied due to the large number of authors.
- Source code organization has been tortured by the constraints of early MS-DOS programs operating in a limited amount of physical memory and the use of overlays.
- Conditional compilation was sprinkled throughout to enable various debugging facilities or experiments in alternative implementations.
- As C does not have inline functions, there are some places that heavily use preprocessor macros.
- Some of the functions are [exceedingly long*](https://github.com/LegalizeAdulthood
- Download SonarQube from SonarQube.org.
- Unpack the distribution.
- Download the C++ community plugin.
- Install the plugin using these instructions.
- Run
bin\windows-x86-64\StartSonar.bat
to start the server. - Wait for the server to output the message
SonarQube is up
. - Browse to
http://localhost:9000
and login withadmin
/admin
. - Create a project by following the built-in tutorial.
- Configure the scanner for C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
comp.lang.c++ #1074341 (1) | |
From: Andrey Tarasevich <[email protected]> | |
[1] A counterintuitive breaking change related to new comparisons | |
Date: Mon Jan 03 10:48:42 MST 2022 | |
Lines: 42 | |
A colleague discovered that switching from `-stc=c++17` to `-std=c++20` | |
in their project resulted in a different behavior from some associative | |
containers. A bit of research allowed to narrow down the culprit to what | |
can be demonstrated by the following minimalist example |
This is a step-by-step guide for porting an application from MFC to wxWidgets based on my experience in porting Hippy.
- wxWidgets documentation for detailed class references.
- wxWidgets wiki for general wxWidgets programming guides
- Compiling using MS VC++
OlderNewer