From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gatech.edu (gatech.edu [130.207.244.244]) by werple.mira.net.au (8.6.12/8.6.9) with SMTP id EAA10421 for ; Thu, 17 Aug 1995 04:27:11 +1000 Received: from math (math.skiles.gatech.edu) by gatech.edu with SMTP id AA05692 (5.65c/Gatech-10.0-IDA for ); Wed, 16 Aug 1995 14:27:07 -0400 Received: by math (5.x/SMI-SVR4) id AA18365; Wed, 16 Aug 1995 14:22:37 -0400 Resent-Date: Wed, 16 Aug 1995 20:24:21 +0200 (MET DST) Old-Return-Path: From: Zoltan Hidvegi Message-Id: <199508161824.UAA23510@bolyai.cs.elte.hu> Subject: Re: hzoli change: $foo:s//r/ To: zsh-workers@math.gatech.edu (zsh-workers) Date: Wed, 16 Aug 1995 20:24:21 +0200 (MET DST) In-Reply-To: <9508161118.aa06965@tenor.clarinet.com> from "Wayne Davison" at Aug 16, 95 11:18:47 am X-Mailer: ELM [version 2.4 PL24] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-Id: <"yGvz71.0.tU4.iTZCm"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/326 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Wayne Davison wrote: > > If you wish to initialize globals in a file that is used to either > declare or define, I find the following syntax more readable: > > -------------------------------------------------------- > #ifdef GLOBALS > # define EXTERN > # define INIT(x) = x > #else > # define EXTERN extern > # define INIT(x) > #endif > > [...] > > /* the last l for s/l/r/ history substitution */ > > EXTERN char *hsubl INIT(NULL); > > /* the last r for s/l/r/ history substitution */ > > EXTERN char *hsubr INIT(NULL); > -------------------------------------------------------- > > This can be used for any type variable and could simplify a few > of the other #ifdef GLOBALS initializations in the file. Yes, it is really a good idea. But if it is really guaranteed that externs are initialized to zere therese initializations are unnecessary. The fact that zsh worked so far shows that it is quite safe to assume that global variables are initialized to zero, but what is in the ANSI-C standard? Zoltan