Handling null pointer exceptions with r0: c++

Hi,If we dereference a K object using r0(), and then try to use that sameK object, it expectadly gives a seg fault. I was wondering if therewas any way to handle this gracefully. I have tried usingstd::runtime_error , but that doesnt seem to work.Also, a related question was if we create a connection to a kdb+database using either khp/khpu, and the database goes down for somereason , this also gives a seg fault, coz the socket connection to thedatabase is now severed. Is there any way to gracefully handle this aswell?I know both these questions are more related to c++ programming ratherthan kdb+. Any help is much appreciated.Regards,Nav

X-Mailer: Apple Mail (2.935.3)> If we dereference a K object using r0(), and then try to use that same> K object, it expectadly gives a seg fault. I was wondering if there> was any way to handle this gracefully. I have tried using> std::runtime_error , but that doesnt seem to work.in theory, i suppose you could use sigaction to install a handler for SIGSEGV, but reusing a deleted object is a pretty big bug

I wonder how the q binary handles. .z.pc ?

.z.pc is detected in the select() loop.On 18 Jun 2009, at 01:45, Tim Rieder wrote:> I wonder how the q binary handles. .z.pc ?>> On Wed, Jun 17, 2009 at 10:47 AM, Aaron Davies > <aaron.davies> wrote:>> > If we dereference a K object using r0(), and then try to use that > same> > K object, it expectadly gives a seg fault. I was wondering if there> > was any way to handle this gracefully. I have tried using> > std::runtime_error , but that doesnt seem to work.>> in theory, i suppose you could use sigaction to install a handler for> SIGSEGV, but reusing a deleted object is a pretty big bug>>>>> >–Apple-Mail-7-707634539Content-Type: text/html.z.pc is detected in the select() loop.



On 18 Jun 2009, at 01:45, Tim Rieder wrote:

I wonder how the q binary handles. .z.pc ?

On Wed, Jun 17, 2009 at 10:47 AM, Aaron Davies <aaron.davies@gmail.com> wrote:

> If we dereference a K object using r0(), and then try to use that same
> K object, it expectadly gives a seg fault. I was wondering if there
> was any way to handle this gracefully. I have tried using
> std::runtime_error , but that doesnt seem to work.

in theory, i suppose you could use sigaction to install a handler for
SIGSEGV, but reusing a deleted object is a pretty big bug







--Apple-Mail-7-707634539--

Thanks for the suggestion. How can we programmatically check in c++ tosee if the q database is up, after doing a khp/khpu?Regards,NavOn Jun 17, 7:47?pm, Aaron Davies <aaron.dav…> wrote:> > If we dereference a K object using r0(), and then try to use that same> > K object, it expectadly gives a seg fault. I was wondering if there> > was any way to handle this gracefully. I have tried using> > std::runtime_error , but that doesnt seem to work.>> in theory, i suppose you could use sigaction to install a handler for ?> SIGSEGV, but reusing a deleted object is a pretty big bug</aaron.dav…>