www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/28/15:06:03

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Question about global arrays
Date: Fri, 28 Feb 1997 09:16:18 -0800
Organization: Alcyone Systems
Lines: 36
Message-ID: <331712E2.32940ABB@alcyone.com>
References: <857066972 DOT 28853 AT dejanews DOT com> <857136466 DOT 656343 AT araga DOT funcom DOT com>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Kurt Skauen wrote:

> I am not shure what the ansi-standard says about this, but I have
> never seen a compiler that treats foo[], as  *foo in a declaration.
> But then again, I have not tried all compilers :)

A pointer is different from an array, so if you declare something as 

    extern char array[];

that is intrinsically different from 

    extern char *array;

If you nix and match the definitions and declarations, then you _will_ have
problems.  Pointers and arrays are not the same.

Arrays are, however, implicitly turned into pointers when passed as
function arguments.

The short answer is:  Declare things how you define them, and vice versa.
Whenever you're trying to be "tricky" or save some typing or save the
compiler some thinking about what it is you mean, it's likely you're doing
something wrong.

> How to kill a daemon:  for(;0;)

Eh?  That doesn't never executes the for statement.

-- 
       Erik Max Francis, &tSftDotIotE / email:  max AT alcyone DOT com
                     Alcyone Systems /    web:  http://www.alcyone.com/max/
San Jose, California, United States /    icbm:  37 20 07 N  121 53 38 W
                                   \
              "I am become death, / destroyer of worlds."
                                 / J. Robert Oppenheimer (quoting legend)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019