C スタイルの配列インデックスの内容を XCode 4.5 内のコンソール ウィンドウに出力する方法を探しています。つまり、オーディオ バッファ (C 配列) が float データでいっぱいになった場合、いっぱいになった後にブレークポイントを置き、配列 [] 内の内容の値を出力したいだけです。私は次のことを試しました:
// Just an example of what I'm doing. The following is a buffer that I am declaring:
int total = 235377;
float tmpArr[total];
// gives me the first index [0] contents value only when I type this in the console window in Xcode
p tmpArr
// gives the following error:
// error: subscripted value is not an array, pointer, or vector
// error: 1 errors parsing expression
p tmpArr[3]
// gives me the address as expected
p &tmpArr
// the following seems to access contents but is casting them to ints and therefore truncating anything after the decimal...in audio programming, the float data is between 0 and 1 sooo....
frame variable -ffloat tmpArr
frame variable -ffloat tmpArr[3]
配列インデックスの内容にアクセスできない理由について、答えを見つけようとしました。ここで何か不足していますか?デバッグするたびに for ループ内に printf() を配置する必要がありますか? ありがとう!
アップデート
@Daniel Fischer が指摘しているように、XCode コンソールで p *(tmpArr + indexNumber) と入力すると、tmpArr[indexNumber] に正常にアクセスし、デバッグ コンソールに出力されます。