1

I have seen a similar discussion here (When should you use constexpr capability in C++11?).

#define kMaxLength 50
#define kSlipsModeSelect 0
#define kSlipsModeAll 1
#define kStatusBarIconWidth 20

All of the above are flagging code analysis:

Macro can be converted to constexpr

It is proposing:

constexpr auto kMaxLength = 50;
constexpr auto kSlipsModeSelect = 0;
constexpr auto kSlipsModeAll = 1;
constexpr auto kStatusBarIconWidth = 20;

What are the benefits of making this change?

bolov
  • 72,283
  • 15
  • 145
  • 224
Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164

0 Answers0