🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.mac
Article #6980

Re: Consulair's Mac C compiler

#6980
From: Tim Smith
Date: Fri, 22 Aug 1986 19:36
34 lines
1809 bytes
Consulair is correct here.  When something is declared as

        extern char *FOO[];

then FOO is an external constant ( the address of an array whose elements
are of type (char *) ).  If the place that allocates storage for FOO uses

        char **FOO;

then FOO is now a variable that holds a pointer to something of type
(char *).  Thus, there is one more level of indirection.

Note that the cited reference in The Book is talking about stuff in
expressions.  You can use either [] notation or * notation to dereference
things, just like The Holy Ones say, in expressions.  However, declarations
are not expressions.  You must declare the variable the same way in both
places for things to work.

On Unix, this often screws up people who use sys_errlist to print error
messages.  It is declared as

        char    *sys_errlist[];

in the header file, and people often put

        char    **sys_errlist;

in their programs, leading to a quick coredump the first time they try
to use it.
--
"I *DO* believe in Mary Worth"

Tim Smith       USENET: sdcrdcf!ism780c!tim || ima!ism780!tim
                Compuserve: 72257,3706          Delphi || GEnie: mnementh
Technical Details
Message-ID: <3307@ism780c.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!columbia!caip!clyde!cbatt!cbosgd!ukmg!psuvm.bitnet!psuvax1!burdvax!sdcrdcf!ism780c!tim
References: <605@ur-tut.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!columbia!caip!clyde!cbatt!cbosgd!ukmg!psuvm.bitnet!psuvax1!burdvax!sdcrdcf!ism780c!tim
From: tim@ism780c.UUCP (Tim Smith)
Newsgroups: net.micro.mac
Subject: Re: Consulair's Mac C compiler
Message-ID: <3307@ism780c.UUCP>
Date: Fri, 22-Aug-86 15:36:03 EDT
Article-I.D.: ism780c.3307
Posted: Fri Aug 22 15:36:03 1986
Date-Received: Thu, 28-Aug-86 22:53:03 EDT
References: <605@ur-tut.UUCP>
Reply-To: tim@ism780c.UUCP (Tim Smith)
Distribution: net
Organization: Interactive Systems Corp., Santa Monica, CA
Lines: 34