[LAD] C - Change in memory causing seg.fault (but why?)

Muffinman news at koster.tk
Fri Nov 9 14:24:56 UTC 2012


On 09-11-12 01:58, Jacob wrote:

> And, BTW, pay attention to the "format ‘%i’ expects type ‘int’" type of
> warnings. Using the wrong or omitting required length modifiers can lead
> to segfaults, too. Even if '%d' and '%ld' refer to integers of the same
> size on an i386 platform, on a 64 bit platform they won't and weird
> things can happen if the argument doesn't match the format spec.
> 
> Jacob


Yeah, that explains why I didn't get any compiling error on a 32bit
computer and did get on a 64bit one (where I did correct the error).
However, the latter was satisfied with %li. Apparently in c++ there is
no difference between long and long int (as far as I can find through
Google) but for c I could not find much info on a potential difference.

Perhaps the resource provided by Tristan can help with that (@Tristan:
btw, thanks for that). I will go through that in the coming week.

Maarten



More information about the Linux-audio-dev mailing list