External Links
Constant pointers or constant pointee
const char*
constant character sequence
char* const
constant pointer
const char *const
constant pointer to constant sequence of characters
The 50 rules from Scott Meyers for effective programming in C++:
- prefer const or inline instead #define (strange compiler errors due to text replacing of the preprocessor)
- prefer <iostream> instead <stdio.h> (no type testing with stdio)
- prefer new and delete instead of malloc and free (are only called by constructors and destructors)
- prefer C++ comments not the C /* */ due nesting error possibilities
A chapter that is often under estimated:
templates in c++
template <class T> bool reange( T value, T min, T max) {
return value >= min && value <= max;
}
that is for the compiler. It save these structure for later use.
bool result = range(5,1,10);
the compiler generates automatically a function with the template above.
bool range( int value, int min, int max) {
return value >=min && value <= max;
}
dynamic_cast
try
{
Base b;
Derived& rd = dynamic_cast<Derived&>(b);
}
catch (std::bad_cast& bc)
{
std::cerr << "bad_cast caught: " << bc.what() << std::endl;
}