[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Uninitialized SCM variables
From: |
David Kastrup |
Subject: |
Re: Uninitialized SCM variables |
Date: |
Wed, 17 Aug 2011 19:30:02 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
"Phil Holmes" <address@hidden> writes:
> In C-style languages, uninitialised variable are uninitialised and
> therefore have an indeterminant value.
Wrong for statically allocated variables.
> Hence the danger of uninitialised pointers. Some other languages do
> initialise them to 0 - visual basic is an example. In more modern
> languages, (c# is one I'm familiar with) the compile fails if a
> variable is not explicitly initialised.
In C++, the compilation is not guaranteed to succeed if the variable is
not explicitly _instantiated_ in some compilation unit (rather than just
being declared as extern). An initialization need not happen: binary
zeros is the default. Unless we are talking classes with constructors.
--
David Kastrup