Minti said:
"Mike Wahler" <
[email protected]> wrote in message
[snip]
#include <regulars_please_correct_me_if_necessary.h>
C <ot>and C++</ot> have a notion of automatic memory and a notion of
dynamic memory.
Automatic memory is the default storage,
In block scope. Storage defined at file scope is has static
storage duration by definition.
and local variables are usually
automatic. This means that memory is automatically allocated for these
variable at the beginning of the block, and that this memory is
automatically freed at the end of the block.
Automatic memory *may* be, on *some* platforms, implemented with a stack.
Dynamic memory is memory that is allocated on demand, with a special
mechanism (in C, usually the 'malloc()' function, <ot>in C++ usually the
'new' operator</ot>), and that must be freed by code - usually in C with
the 'free()' function <ot>and in C++ with 'delete'</ot>). Not freeing
dynamically allocated memory (usually) causes a 'memory leak'.
Dynamic memory *may* be, on *some* platforms, implemented with a 'heap'.
Third hint : please learn the difference between C and C++, choose the
one you like, get yourself a *good* book on it, and post on the
appropriate group - after you've read the group's FAQ.
Wrong there are 3 types of memory
That's 'storage duration'.
in C and C++
1) Automatic
2) Dynamic
3 and Static
Yes there are, but I don't think Bruno's message was 'wrong'.
The acknowledgement of the existence of apples and oranges
does not imply denial of the existence of bananas. I didn't
see Bruno say 'only' automatic and dynamic (actually the formal
term for the latter is 'allocated' (6.2.4)).
An incomplete statement is an incomplete statement.
But 'incomplete' does not mean 'incorrect'.
You responded to Bruno with "Wrong there are 3 types..."
Bruno did not say "there are two types". He simply
enumerated two of the three.
His exact words from above:
"C <ot>and C++</ot> have a notion of automatic memory
and a notion of dynamic memory."
The
acknowledgement that apples and oranges are the fruits on this earth
does seem to be incomplete.
It was an analogy, meant to convey the statement: "Acknowledgement
of the existence of one or more entities does not imply denial
of existence of others."
I didn't see Bruno say 'these are the
subset of the storage types' automatic and ****allocated****[if that
is the way you want it ;-)]
No he didn't say that. See above. You're assuming that
his list was exhaustive when he didn't specifically say so.
BTW if you look carefully at the header he had indeed asked for
*correction* just in case you did not see here it is
What he said was, as you note, incomplete, but not incorrect.
E.g. "C has data types 'int' and 'long'" is a correct (albeit
'incomplete') statement. But it does *not* imply that C has
no other data types.
""""
#include <regulars_please_correct_me_if_necessary.h>
Right. What he said was not incorrect.
""""
Maybe he asked for *only* regular regulars then in that case I am
sorry for jumping in your business.
The content of (and replies thereto) all messages in a Usenet
newsgroup are, by definition, the business of anyone and
everyone who cares to read (and/or respond to) it/them.
Public forum, and all that.
Semicolon.