{{indexmenu_n>25}} ====== literalとstatic const ====== 以下のファイルをライブラリとしてコンパイルしてstcdll.dllを作るとします。 namespace stcdll { public ref class C { public: static const int SCI = 1; literal int LI = 2; }; } このstcdll.dllを使うプログラムを考えます。 #using "stcdll.dll" int main() { int a[stcdll::C::LI]; // OK int b[stcdll::C::SCI]; // Error return 0; } literalで宣言した変数はコンパイル時でも値が読めるが、static constの方は読めない。 Visual C++ 2005 EEだと、実行時にstatic constの値を読むとアプリが落ちる。(おそらくバグ)