[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-audio-dev
Subject: Re: [LAD] Segfault when trying to dereference __midi_event.buffer (c++ newbie question)
From: Paul Davis <paul () linuxaudiosystems ! com>
Date: 2012-11-21 13:11:11
Message-ID: CAFa_cKnDfp+LHgSFowSUEqm+HYYdb=EsR9t6nsbmykRnUdNyZg () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On Wed, Nov 21, 2012 at 7:49 AM, Shani Hadiyanto Pribadi <
shanipribadi@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.
[Attachment #5 (text/html)]
<br><br><div class="gmail_quote">On Wed, Nov 21, 2012 at 7:49 AM, Shani Hadiyanto \
Pribadi <span dir="ltr"><<a href="mailto:shanipribadi@gmx.net" \
target="_blank">shanipribadi@gmx.net</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> That's it. Apparently the cause of segfault is \
dereferencing the pointer when there's no data.<br>After adding checks for \
available data the segfault does not happen anymore.<br><br>It never occured to me \
that was the cause because on the C version, accessing the pointer when there's \
no data<br>
returns 0x6a but didn't segfault. <br></blockquote><div><br>accessing an \
undefined pointer has undefined results. you can rely on that. in C, in C++ and in \
any other language with pointers.<br></div></div>
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic