動作環境
C++ Builder XE4
RAD Studio 10.2 Tokyo Update 2 (追記: 2017/12/28)
Winソフトを実装していて気づいた点。
case文最後のbreakでブレークポイントを設定しても無効になる。
Unit1.cpp
//---------------------------------------------------------------------------
# include <vcl.h>
# pragma hdrstop
# include "Unit1.h"
//---------------------------------------------------------------------------
# pragma package(smart_init)
# pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
static int swithBreakTest(int idx)
{
switch(idx) {
case 0:
OutputDebugString(L"0");
break;
case 1:
OutputDebugString(L"1");
break;
case 2:
OutputDebugString(L"2");
break;
}
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
swithBreakTest(/*idx=*/0);
swithBreakTest(/*idx=*/1);
swithBreakTest(/*idx=*/2);
}
//---------------------------------------------------------------------------
以下の画像にて緑色のブレークポイントは無効の意味となる。
実際に実行したところ、緑の部分では停止しなかった。
MSP430などでは_bis_SR_register(LPM3_bits + GIE);
の次の行がブレークポイントが取れなかった (コメント )。
コンパイラの最適化が関係していたと教えていただいたことがあるが、XE4でも同じようなことが起きているのだろうか。