Mail Archives: djgpp/1998/02/06/00:01:15
Maciej Radziejewski wrote:
>
> Perhaps it is too obvious to write, but isn't this accomplished in C++
> by defining a local scope and declaring the variables inside it?
> The variables will be destroyed upon leaving the local scope.
Yes, but such variables are automatic, not static. Use of the term
"static" implies a variable that remains throughout the duration of the
program. By its very definition, a static variable cannot be deleted or
freed. However, the data it contains can be modified, so if you define
a static pointer, you could certainly free the memory it points to
(assuming, of course, that you allocated some to begin with).
--
---------------------------------------------------------------------
| John M. Aldrich | "It may be better to be a live jackal|
| aka Fighteer I | than a dead lion, but it is better |
| mailto:fighteer AT cs DOT com | still to be a live lion." |
| http://www.cs.com/fighteer | - Lazarus Long |
---------------------------------------------------------------------
- Raw text -