我編譯爲LPC1114,一個小的ARM(實際上是Cortex)目標。 RAM比ROM更有限。我使用最新的Mentor(CodeBenchLite)GCC編譯器(GCC 4.6.3)。我有一些我想在ROM中使用的常量對象。據我所知,下面的代碼中的ffx對象應該以ROM(代碼)結尾,但是它被放置在DATA中。 class flop {
public:
int x;
c
我想聲明初始化一些常量整數值的constexpr指針,但鐺被挫敗我所有的嘗試: 嘗試1: constexpr int* x = reinterpret_cast<int*>(0xFF);
test.cpp:1:20: note: reinterpret_cast is not allowed in a constant expression
嘗試2: constexpr int* x =
我們知道C++ template metaprogramming is Turing complete,但是preprocessor metaprogramming is not。 C++ 11爲我們提供了一種新的元編程形式:計算constexpr函數。這種計算形式是否完成圖靈?我在想,因爲遞歸和條件運算符(?:)在constexpr函數中是允許的,但是我希望有更多專業知識的人來確認。