(Click here for a personal note from Marshall Cline.)
C++ FAQ
/
Section 4
/ FAQ 4.5
Section 4:
4.1
Updates for the 03/12 release?
New!
4.2
Updates for the 11/11 release?
New!
4.3
Updates for the 07/11 release?
4.4
Updates for the 05/11 release?
4.5
Updates for the 03/11 release?
4.6
Updates for the 08/10 release?
4.7
Updates for the 06/10 release?
4.8
Updates for the 05/10 release?
4.9
Updates for the 04/10 release?
4.10
Updates for the 03/10 release?
4.11
Updates for the 01/10 release?
4.12
Updates for the 09/09 release?
4.13
Updates for the 06/09 release?
4.14
Updates for the 01/09 release?
4.15
Updates for the 03/07 release?
4.16
Updates for the 09/06 release?
4.17
Updates for the 03/06 release?
4.18
Updates for the 10/05 release?
4.19
Updates for the 07/05 release?
4.20
Updates for the 06/05 release?
4.21
Updates for the 05/05 release?
4.22
Updates for the 04/05 release?
4.23
Updates for the 03/05 release?
4.24
Updates for the 02/05 release?
4.25
Updates for the 12/04 release?
4.26
Updates for the 06/04 release?
4.27
Updates for the 08/03 release?
4.28
Updates for the 06/03 release?
4.29
Updates for the 05/03 release?
4.30
Updates for the 04/03 release?
4.31
Updates for the 03/03 release?
4.32
Updates for the 02/03 release?
4.33
Updates for the 01/03 release?
4.34
Updates for the 12/02 release?
4.35
Updates for the 09/02 release?
4.36
Updates for the 06/02 release?
4.37
Updates for the 05/02 release?
4.38
Updates for the 04/02 release?
4.39
Updates for the 03/02 release?
4.40
Updates for the 08/01 release?
4.41
Updates for the 04/01 release?
4.42
Updates for the 07/00 release?
4.43
Updates for the 03/00 release?
4.44
Updates for the 01/00 release?
4.45
Updates for the 10/99 release?
4.46
Updates for the 07/99 release?
4.47
Updates for the 06/98 release?
4.48
Updates for the 05/98 release?
4.49
Updates for the 09/97 release?
4.50
Updates for the 01/97 release?
4.51
Updates for the 11/96 release?
4.52
Updates for the 10/96 release?
4.53
Updates for the 09/96 release?
4.54
Updates for the 08/96 release?
4.55
Updates for the 07/96 release?
4.56
Updates for the 06/96 release?
4.57
Updates for the 05/96 release?
4.58
Updates for the 04/96 release?
4.59
Updates for the 03/96 release?
4.60
Updates for the 09/95 release?
4.61
Updates for the 06/95 release?
4.62
Updates for the 04/95 release?
4.63
Updates for the 03/95 release?
4.64
Updates for the 01/95 release?
4.65
Updates for the 12/94 release?
4.66
Updates for the 11/94 release?
4.67
Updates for the 08/94 release?
4.68
Updates for the 08/94 release?
[4.5] What updates were made for the 03/11 release?
6 New FAQs:
[2.3] Where can I find the C++ FAQ translated into Belorussian (Minsk)?
(created with much thanks to translator
M. Ruzkowski
)
[2.8] Where can I find the C++ FAQ translated into German?
(created with much thanks to translator
Julian Albrecht
)
[4.5] What updates were made for the 03/11 release?
(created)
[8.7] What does it mean that a reference must refer to an object, not a dereferenced
NULL
pointer?
(created thanks to a suggestion from
Brendan Iribe
)
[10.22] What is the purpose of the
explicit
keyword?
(created thanks to
Joseph Coffland
)
[15.22] How can I print a
char
as a number? How can I print a
char*
so the output shows the pointer's numeric value?
Updated!
(created thanks to some great work by
Paul Feraud
)
24 Changed FAQs:
[2.13] Where can I find the C++ FAQ translated into Romanian?
(fixed a typo thanks to alert reader
Riff
)
[10.7] Should you use the
this
pointer in the constructor?
(fixed a typo thanks to
Thomas Middeldorp
)
[10.21] Why am I getting an error after declaring a
Foo
object via
Foo x(Bar())
?
(added some more fine print on the second solution thanks to alert reader Dan Nabutovsky)
[11.14] Is there a way to force
new
to allocate memory from a specific memory area?
(typo in the code (
null
vs.
NULL
) was fixed thanks to
Eli Bendersky
)
[12.4] I'm creating a derived class; should my assignment operator call my base class's assignment operator?
(fixed a typo thanks to
Thomas Middeldorp
)
[13.12] I still don't get it. Why shouldn't my
Matrix
class's interface look like an array-of-array?
(fixed two typos thanks to
Thomas Middeldorp
)
[16.2] Is it safe to
delete
the same pointer twice?
(fixed a typo thanks to
Thomas Middeldorp
)
[16.12] What if I forget the
[]
when
delete
ing an array allocated via
new T[n]
?
(fixed a typo thanks to
Thomas Middeldorp
)
[16.13] Can I drop the
[]
when
delete
ing an array of some built-in type (
char
,
int
, etc)?
(fixed a typo thanks to
Thomas Middeldorp
)
[16.15] Is it legal (and moral) for a member function to say
delete this
?
(fixed some typos thanks to
Thomas Middeldorp
)
[16.25] Can I absolutely
prevent
people from subverting the reference counting mechanism, and if so,
should
I?
(fixed two typos thanks to
Thomas Middeldorp
)
[16.26] Can I use a garbage collector in C++?
(fixed a typo thanks to
Thomas Middeldorp
)
[17.2] I'm still not convinced: a 4-line code snippet shows that return-codes aren't any worse than exceptions; why should I therefore use exceptions on an application that is orders of magnitude larger?
(improved the wording thanks to
Thomas Middeldorp
)
[17.8] How can I handle a constructor that fails?
(added a discussion about memory leaks thanks to an insightful question from
Wojciech "Spook" Sura
)
[18.1] What is "
const
correctness"?
(fixed two typos thanks to
Thomas Middeldorp
)
[18.17] Why am I getting an error converting a
Foo**
→
Foo const**
?
(fix two typos thanks to
Thomas Middeldorp
)
[20.5] How can a member function in my derived class call the same function from its base class?
(fixed a typo thanks to
Thomas Middeldorp
)
[20.7] When should my destructor be
virtual
?
(changed "explicit destructor" to "explicitly defined destructor" to avoid confusion with the
explicit
keyword used with constructors)
[21.2] Converting
Derived*
→
Base*
works OK; why doesn't
Derived**
→
Base**
work?
(fixed a typo thanks to
Thomas Middeldorp
)
[23.9] What's the meaning of,
Warning: Derived::f(char) hides Base::f(double)
?
(fixed a typo thanks to
Thomas Middeldorp
)
[25.6] Is there a simple way to visualize all these tradeoffs?
(improved the wording and fixed some typos thanks to
Rob Swarbrick
and
Thomas Middeldorp
and
Martinho Fernandes
)
[25.7] Can you give another example to illustrate the above disciplines?
(fixed a typo thanks to
Thomas Middeldorp
)
[27.1] What are some good C++ coding standards?
(fixed a typo thanks to
Thomas Middeldorp
)
[29.2] Where do I start? Why do I feel so confused, so stupid?
(fixed two broken links thanks to alert reader Dan Nabutovsky)