On 10/17/07, Eric Iverson <[EMAIL PROTECTED]> wrote:
> If you tried that memr expression in C (e.g., strcpy(...)) you would get a
> crash.

But I don't lose my command line environment with C, because
each C program gets its own process.

> Sometimes higher level routines give special meaning to a 0 pointer
> (usually that a default value is used) but lower level routines such as
> strcpy and memr do not (what would the default value be?).

I just want a different kind of error -- instead of J crashing for a null
pointer pased to memr, I want a run-time error.  In other words,
something like:

   memr=: ] (15!:[EMAIL PROTECTED] [EMAIL PROTECTED])@, 0 0 _1 }.~ #

Since so many routines which return valid pointers also return
null pointers for relatively common cases, I think this is a reasonable
approach.

Note also that null pointers are unique -- they are not like other pointers
into invalid memory.

Historically speaking, early instances of C had a problem where null
pointers were pointers into valid memory.  Special effort was made to
ensure that they always pointed at invalid memory, because this made
debugging easier.  My point here is that null pointers have always been
a different kind of thing than any other invalid pointer.

> Treating 0 special out of all the values that can cause memr to crash is not
> worthwhile.

But the 0 pointer is special.

http://en.wikipedia.org/wiki/Pointer#The_null_pointer
http://c-faq.com/null/

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to