The #error Preprocessor Directive
During the preprocessing phase, you can report errors by using the #error preprocessor directive. For example, suppose you have a program that uses 64-bit integers. This program has to be
During the preprocessing phase, you can report errors by using the #error preprocessor directive. For example, suppose you have a program that uses 64-bit integers. This program has to be
Although the library was deprecated for several years, many C++ users still use it in new code instead of using the newer, standard compliant library. What are the differences between
To generate random floating numbers, choose a floating point number, divide it by the largest value of int type and multiply the result by the value of a function that
C++ requires that the size of an array be a constant integral expression. However, the following code refuses to compile: // in const.hextern const int ID_LENGTH; // declaration// in const.cppconst
You can override the default number of digits after the decimal point by calling the precision() member function of an ostream object. The following program first displays six digits after
To create an iterator of a vector, you have to use a vector specialization. In the following examples, I create two vector iterators: one for the specialization vector and another
By default, cout displays integral values as decimal numbers. You can override this setting and have integral values displayed in hexadecimal and octal notations by using the ‘hex’ and ‘oct’
In C++, pointers are strongly-typed. Therefore, you can’t assign a void pointer to any other pointer type without casting it explicitly: int n;void *p = &n;int *pi=static_cast< int* >(p);//C++ requires
C++ guarantees that operator delete checks its argument for null-ness. If the argument is 0, the delete expression has no effect. In other words, deleting a null pointer is a