🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #6162

Re: JRComm, VLT, Handshake

#6162
From: Larry Phillips
Date: Sat, 27 Oct 1990 21:49
39 lines
2160 bytes
In <466@faatcrl.UUCP>, jprad@faatcrl.UUCP (Jack Radigan) writes:
>andy@cbmvax.commodore.com (Andy Finkel) writes:
>
>>If your program breaks when location 0 is non NULL this means
>>you have an unitialized pointer somewhere in your program, and
>>are using memory you did not allocate (ie location 0)
>
>  Uh, according to K&R, NULL is a valid assignment for a pointer, so
>how is it unitialized?
>
>  Where I got bit is in a pathname building routine that I wrote which
>did a strlen() without explicitly checking for NULL first, it now does.
>
>  But, my question is the NULL pointer itself, if NULL is a valid constant,
>then the location NULL should contain nothing either, right?
>
>  If I somehow missed something so embarrassingly basic, how come I can't
>find it in K&R, which is supposed to be the last word in 'C'?

Don't know about K&R, but on the Amiga, you can specifically look at location
4, and expect a value there that is meaningful. There is no other absolute
address that can be looked at, without using a label, allocating memory,
allocating a resource, etc., and that can be expected to have a meaningful
value. Same thing, essentially, with writing.

Yes, NULL is a valid value for a pointer. If, however, you try to use it for
anything other than an indication that the pointer is not initialized to
something meaningful, you will get bitten.

-larry

--
It is not possible to both understand and appreciate Intel CPUs.
    -D.Wolfskill
+-----------------------------------------------------------------------+ 
|   //   Larry Phillips                                                 |
| \X/    lphillips@lpami.wimsey.bc.ca -or- uunet!van-bc!lpami!lphillips |
|        COMPUSERVE: 76703,4322  -or-  76703.4322@compuserve.com        |
+-----------------------------------------------------------------------+
Technical Details
Message-ID: <2171@lpami.wimsey.bc.ca>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!van-bc!

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!van-bc!
From: lphillips@lpami.wimsey.bc.ca (Larry Phillips)
Newsgroups: comp.sys.amiga.tech
Subject: Re: JRComm, VLT, Handshake
Message-ID: <2171@lpami.wimsey.bc.ca>
Date: 27 Oct 90 21:49:19 GMT
Lines: 39
Return-Path: <lpami!lphillips>
To: van-bc!rnews