Re: Function header files
Malcolm McLean <firstname.lastname@example.org> writes:
> On Feb 16, 2:04Â*am, alanxx <alanxxi...@gmail.com> wrote:
>> I am a student of C/C++. One of the mistakes I often make is
>> forgetting to include the appropriate header files for the standard
>> functions I use.
> If it does input/output stdio.h.
There are a lot of IO function not declared there. wchar.h declares all
the "wide" IO functions.
> If it's a trivial function that works
> on a string or area of memory, string.h.
Except for those that operate on wide or multi-byte strings.
> If it's a mathematical
> function, math.h.
Except for the type generic maths functions declared in tgmath.h and all
the complex mathematical functions declared in complex.h.
> If it's malloc() and family or anything else,
> stdlib.h. Major exceptions - ctype.h contains [the] is... macros.
And wctype.h declares the isw... functions. By the way, what you call
the is... macros must be functions, though they can be macros as well.
> assert.h has its own header for some reason. So does time.h.
And there is also stdint.h, inttypes.h, bool.h, complex.h, float.h,
errno.h, setjmp.h, signal.h, stdarg.h, locale.h and fenv.h (and that's
not all of them).
> It's a reasonably logical division, though with a few quirks.
Unfortunately the logic requires some knowledge of the history. For
example the wide IO and string functions are separate because they are
My point is not to enumerate the errors in your classification but to
show that your general point -- which seems to be that it's not too hard
to remember -- is not really true anymore.