[LAD] Segfault when trying to dereference __midi_event.buffer (c++ newbie question)

Paul Davis paul at linuxaudiosystems.com
Wed Nov 21 13:11:11 UTC 2012


On Wed, Nov 21, 2012 at 7:49 AM, Shani Hadiyanto Pribadi <
shanipribadi at gmx.net> wrote:

> That's it. Apparently the cause of segfault is dereferencing the pointer
> when there's no data.
> After adding checks for available data the segfault does not happen
> anymore.
>
> It never occured to me that was the cause because on the C version,
> accessing the pointer when there's no data
> returns 0x6a but didn't segfault.
>

accessing an undefined pointer has undefined results. you can rely on that.
in C, in C++ and in any other language with pointers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20121121/0e6e9b2a/attachment.html>


More information about the Linux-audio-dev mailing list