From: Zefram <A.Main@dcs.warwick.ac.uk>
To: hzoli@cs.elte.hu (Zoltan Hidvegi)
Cc: zsh-workers@math.gatech.edu (Z Shell workers mailing list)
Subject: Re: hzoli change: $foo:s//r/
Date: Wed, 16 Aug 1995 23:22:37 +0100 (BST) [thread overview]
Message-ID: <10463.199508162222@stone.dcs.warwick.ac.uk> (raw)
In-Reply-To: <199508161824.UAA23510@bolyai.cs.elte.hu> from "Zoltan Hidvegi" at Aug 16, 95 08:24:21 pm
>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?
ANSI requires that all objects of static storage duration (i.e.
non-auto variables) are initialised to zero(*), except when explicitly
initialised to something else. (*) Integers are initialised to
all-bits zero, which is numerically zero, but floating-point values are
initialised to floating-point zero, and pointers are initialised to a
NULL value which is not required to be all-bits zero.
This requirement has existed throughout C's lifetime; it initially
appeared, I think, because such variables under Unix are put in the BSS
area, which the kernel initialises to all-bits zero. The ANSI
committee had no choice but to uphold the assumption made by most C
programmers that this initialisation would take place, but they made
the required initialisation effectively "numerically zero" rather than
"all-bits zero" because of the unspecified nature of pointer and
floating-point representations.
Under Unix it's quite safe to assume that this initialisation will
happen (to all-bits zero, which under Unix is good for a NULL pointer)
even in languages that make no such guarantee.
-zefram
next prev parent reply other threads:[~1995-08-16 22:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-08-15 12:49 Heading, Anthony
1995-08-15 17:02 ` Zoltan Hidvegi
1995-08-16 1:48 ` Thorsten Meinecke
1995-08-16 11:59 ` Zoltan Hidvegi
1995-08-16 14:49 ` Thorsten Meinecke
1995-08-16 15:20 ` Zoltan Hidvegi
1995-08-16 16:01 ` Barton E. Schaefer
1995-08-16 18:18 ` Wayne Davison
1995-08-16 18:24 ` Zoltan Hidvegi
1995-08-16 22:22 ` Zefram [this message]
1995-08-15 18:36 Heading, Anthony
1995-08-15 17:52 ` Zoltan Hidvegi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10463.199508162222@stone.dcs.warwick.ac.uk \
--to=a.main@dcs.warwick.ac.uk \
--cc=hzoli@cs.elte.hu \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).