Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #60914

Re: Null Pointer exceptions

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: Null Pointer exceptions
Date 2015-04-23 12:32 -0400
Organization Self
Message-ID <55391E84.9020703@verizon.net> (permalink)
References <mh9451$ib4$1@speranza.aioe.org> <pan.2015.04.23.02.14.12.829000@nowhere.invalid>

Show all headers | View raw


On 04/22/2015 10:14 PM, Nobody wrote:
> On Wed, 22 Apr 2015 21:34:25 +0000, jeff wrote:
> 
>> My question is: is there a way to deal with all of these problems in one 
>> swoop, by ignoring all code that dereferences a null pointer, i.e. null 
>> dereference becomes a NO-OP instead of triggering an exception. ?
> 
> In a sense, existing mechanisms already ignore "all code that dereferences
> a null pointer", i.e. they terminate the process, resulting in the code
> (i.e. the remainder of the program) being ignored. Maybe you meant to
> suggest that it should ignore some smaller portion of the code? ...

He seemed quite specific to me: "null dereference becomes a NO-OP".
That's a very small portion of the code, often just a single instruction.

...
> As for treating null dereference as a no-op: how can it? ...

Well, the following seems the obvious interpretation of what he's saying:

> ... Just use whatever value happened to already be in the memory (or
> register)? That's likely to just result in cascading failures; if the
> value is itself a pointer, offset or index (or is used in the calculation
> of such), you're going to end up accessing random memory locations.

If that bothered him (as it should) he wouldn't be asking this question.

Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Null Pointer exceptions jeff <nospam@nospam.com> - 2015-04-22 21:34 +0000
  Re: Null Pointer exceptions James Kuyper <jameskuyper@verizon.net> - 2015-04-22 18:02 -0400
    Re: Null Pointer exceptions Stephen Sprunk <stephen@sprunk.org> - 2015-04-22 18:30 -0500
      Re: Null Pointer exceptions James Kuyper <jameskuyper@verizon.net> - 2015-04-22 19:44 -0400
        Re: Null Pointer exceptions Stephen Sprunk <stephen@sprunk.org> - 2015-04-23 11:53 -0500
          Re: Null Pointer exceptions Richard Heathfield <rjh@cpax.org.uk> - 2015-04-23 18:59 +0100
  Re: Null Pointer exceptions Barry Schwarz <schwarzb@dqel.com> - 2015-04-22 15:17 -0700
    Re: Null Pointer exceptions James Dow Allen <gmail@jamesdowallen.nospam> - 2015-04-23 04:11 +0000
  Re: Null Pointer exceptions Robert Wessel <robertwessel2@yahoo.com> - 2015-04-22 17:19 -0500
  Re: Null Pointer exceptions Ben Bacarisse <ben.lists@bsb.me.uk> - 2015-04-22 23:46 +0100
  Re: Null Pointer exceptions Nobody <nobody@nowhere.invalid> - 2015-04-23 03:14 +0100
    Re: Null Pointer exceptions James Kuyper <jameskuyper@verizon.net> - 2015-04-23 12:32 -0400

csiph-web