mirror of
https://gitlab.com/fbb-git/cppannotations
synced 2024-11-16 07:48:44 +01:00
Processed 1st e-mail by Steve Andrews
git-svn-id: https://cppannotations.svn.sourceforge.net/svnroot/cppannotations/trunk@602 f6dd340e-d3f9-0310-b409-bdd246841980
This commit is contained in:
parent
d106b34d95
commit
bbba302fec
3 changed files with 8 additions and 7 deletions
|
@ -12,7 +12,8 @@ aggregate data within the context of classes or to define elaborate return
|
|||
values. Often a bf(C++) tt(struct) merely contains em(plain old data) (POD,
|
||||
cf. section ref(POD)). In bf(C++) the tt(class) is the main data structuring
|
||||
device, by default enforcing two core concepts of current-day software
|
||||
engineering: em(data hiding) (cf. sections ref(HIDING) and ref(APPLICATION)).
|
||||
engineering: em(data hiding) and em(encapsulation) (cf. sections ref(HIDING)
|
||||
and ref(APPLICATION)).
|
||||
|
||||
The tt(union) is another data structuring device the language offers. The
|
||||
traditional bf(C) union is still available in bf(C++), but the C++0x standard
|
||||
|
|
|
@ -48,7 +48,7 @@ those variables using tt(iter) the tt(auto) keyword can be used again:
|
|||
)
|
||||
|
||||
If tt(start) can't be initialized immediately using an existing
|
||||
variable the type of a well known variable of function can be used in
|
||||
variable the type of a well known variable or function can be used in
|
||||
combination with the ti(decltype) keyword, as in:
|
||||
verb(
|
||||
decltype(iter) start;
|
||||
|
|
|
@ -20,11 +20,11 @@ string objects:
|
|||
)
|
||||
No special action is performed if a dynamically allocated array of
|
||||
primitive typed values is deleted. Following tt(int *it = new int[10]) the
|
||||
statement tt(delete[] it) simply returns the memory pointed at by tt(it) is
|
||||
returned. Realize that, as a pointer is a primitive type, deleting a
|
||||
dynamically allocated array of pointers to objects does em(not) result in the
|
||||
proper destruction of the objects the array's elements point at. So, the
|
||||
following example results in a emi(memory leak):
|
||||
statement tt(delete[] it) simply returns the memory pointed at by tt(it).
|
||||
Realize that, as a pointer is a primitive type, deleting a dynamically
|
||||
allocated array of pointers to objects does em(not) result in the proper
|
||||
destruction of the objects the array's elements point at. So, the following
|
||||
example results in a emi(memory leak):
|
||||
verb(
|
||||
string **sp = new string *[5];
|
||||
for (size_t idx = 0; idx != 5; ++idx)
|
||||
|
|
Loading…
Reference in a new issue