The STL is documented elsewhere
[ stl.html ]
on this site.
Here are some of the C libraries that have been inheritted by
C++.
cctype
Originally <ctype.h> and useful for character handling.
In C++
#include <cctype>
and in C
#include <ctype.h>
One of the oldest and most useful C++ libraries
is the Character Type library inheritted from ANSI C.
You use these function to classify characters by their type
and they work on even weird character sets like EBCDIC.
On the other hand they don`t work on strings or arrays of characters.
Most of the fucntions test for particular types of characters, but
two function change a characters case...
In the following list c stands for a char.
- For c:char.
- isalnum(c)::bool=c is an alphanumeric character.
- isalpha(c)::bool=c is a letter.
- iscntrl(c)::bool=c is a special control character, ASCII(0)..ASCII(31).
- isdigit(c)::bool=c is a decimal digit, '0'..'9'.
- isgraph(c)::bool=c is a graphic character, a printing character other than space.
- islower(c)::bool=c is a lower case letter, 'a'..'z'.
- isprint(c)::bool=c is not a control character but prints something including a space.
- ispunct(c)::bool=c is a punctuation character = isprint(c) && !isspace(c) && !isalnum(c).
- isspace(c)::bool=c is a white space character including space, tab, newline, carriage return etc..
- isupper(c)::bool=c is an UPPER CASE LETTER.
- isxdigit(c)::bool=c is a hexadecimal digit, '0'..'9' | 'A'..'F' | 'a'..'f'.
The following functions we defined backwards until gisli_tru@hotmail.com sent
me Email pointing out my mistake. Thank you!
- toupper(c)::char=converts lower case letters into upper case letters and copies all others.
- tolower(c)::char=converts upper case letters into lower case letters and copies all others.
For more see
[ c++.cctype.html ]
(including sample code etc).
. . . . . . . . . ( end of section cctype) <<Contents | End>>
cstddef
AKA stddef.h.
In C++
#include <cstddef>
and in C
#include <stddef.h>
- NULL::pointer=a pointer at nothing.
- size_t::data_type=used for sizes of strings, buffers, arrays,....
- ptrdiff_t::data_type=number that results from subtracting one pointer from another one.
- wchar_t::data_type=wide characters.
- offsetof::size_t=How far from the start of a struct is a field?.
cassert
AKA assert.h.
In C++
#include <cassert>
and in C
#include <assert.h>
- assert(b)::statement=test b and if zero prints out expression, line, etc before aborting the program.
I use <cassert> for two purposes. First as a simple way to reject
bad data handed to a function -- in C++ it is better to throw an exception.
int mySqrt(int x) { assert (x>=0); ...}
Second, to write quick unit tests of classes and functions in a simple
form of Test Driven Development.
int main(){ assert (mySqrt(0)==0); ...}
- NDEBUG::=No Debug, #defined to turn off asserts.
cmath -- lots of elementary functions and a constant.
HUGE_VAL, acos, asin, atan, atan2, cos, sin, tan, cosh, sinh, tanh,
exp, frexp, ldexp, log, log10, modf, pow, sqrt,
ceil, fabs, floor,fmod
[click here
if you can fill this hole]
cstdlib
[click here
if you can fill this hole]
To Be Done
C: stdarg.h, time.h, signal.h, locale.h
Definitions from the C++ Standard
- char::data_type=the 8 bit character set avaliable on the computer in use.
- bool::data_type=data that is true or false and is used in conditions.