3

In older gcc versions (~6.X) the following code worked, however with newer version there are compile-errors.

struct test{
    constexpr static int* PORT1 = reinterpret_cast<int*>(0x12345678);
};

Compiler:

error: reinterpret_cast from integer to pointer

A C-like cast doesnt work either.

Note: Its for memory-maped-io, so i really want to read/write to a fixed address

Domso
  • 970
  • 1
  • 10
  • 22

0 Answers0