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
  • 65,999
  • 14
  • 127
  • 202
Andrew Truckle
  • 15,857
  • 13
  • 55
  • 132

0 Answers0