> i doesn't exist -- it was optimized away because your code is equivalent to
> this
>
Okay, I will never write pseudo-like code to demonstrate what I mean :/
fmt is a structure holding all meta-data of the audio-input. convertchannels()
is called by a function which reads fmt->byterate audio-data from stdin, and
provides another array big enough to hold a copy of the input-data (datacopy).
void
convertchannels(short *data, short *datacopy)
{
int i, j = 0;
int inbyterate = fmt->samplerate * fmt->channels * 2;
memcpy(datacopy,data,inbyterate * sizeof(short));
if(fmt->channels == 1) {
for(i=0;i <= inbyterate;i++) {
/* mono to left ... */
data[j++] = datacopy[i];
/* mono to right ... */
data[j++] = datacopy[i];
}
}
else
sysfatal("convertchannels(): I can just convert from mono to
stereo :-/\n");
>
> - erik
>
> On Sat Jul 15 05:55:56 CDT 2006, [EMAIL PROTECTED] wrote:
>>
>> Hi folks,
>>
>> I got a function which goes like this:
>> void
>> m00(...)
>> {
>> int i,j = 0;
>>
>> if(foo) {
>>
>> for(i=0;i<=n;i++) {
>> some_data[j++] = srcdata[i]
>> }
>>
>> } else {
>> ...
>> }
>> }
>>
>> (ignore the errors)
>>
>> I get a fault write. Jippie. Starting to acid arround, I came across this:
>>
>> acid: *m00:j
>> 0x00000000
>> acid: *m00:i
>> <stdin>:3: (error) colon: local variable not found
>> acid:
>>
>> so obviously acid does not 'see' i because it is first used in a new block
>> (the if()), at least I guess so. How do I display the value of i in acid?
>>
>>
>> Mfg, Sascha