Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: hzoli change: $foo:s//r/
- X-seq: zsh-workers 326
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (zsh-workers)
- Subject: Re: hzoli change: $foo:s//r/
- Date: Wed, 16 Aug 1995 20:24:21 +0200 (MET DST)
- In-reply-to: <9508161118.aa06965@xxxxxxxxxxxxxxxxxx> from "Wayne Davison" at Aug 16, 95 11:18:47 am
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author