Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit aa366d08 authored by Aaron Okano's avatar Aaron Okano
Browse files

Change const to constexpr

static const within a class is somewhat broken in a variety of contexts
in C++. In particular, you should not try to define the value at the
declaration site, like:

    class MyClass {
      public:
        static const int mConst = 5;
    };

For some reason, C++ allows this, but then you can only use mConst in
integral constant expressions. If you need a reference, then this whole
thing breaks. However, under certain compilation options, the compiler
may compile away the references and it will compile anyway (which seems
to be the status quo for this particular case).

Anyway, I have been fiddling with the compiler options, and I now get an
undefined references for the constants in this file. Because we don't
actually need a concrete object in memory for these values, static
constexpr should be a much better option for such a constant.

Reference: https://stackoverflow.com/a/3026054
Flag: EXEMPT bugfix
Change-Id: I054063040f822ac86ae73d8ab59603474bb52586
parent 4ecdd87b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment