M
Mark
Hello
I once read that it's not a good programming style to #include in header files, where structs, typedefs or functions are declared. Just to illustrate:
/* foo.h */
#ifndef FOO_H
#define FOO_H
extern int foo1(int, int);
extern double foo2(double, double);
#endif
/* foo.c */
#include "foo.h"
/* here to include any other necessary headers */
int foo1(int x, int y)
{
...
}
double foo2(double x, double y)
{
...
}
What to do if, say, a function declared has one of parameters of type 'size_t'. This type is defined in stddef.h, so incusion of this file is inevitable:
/* foo.h */
extern void foo3(char *, size_t);
...
Is there a common way to workaround this, or it is perfectly well to have file included in the headers?
Thanks.
--
Mark
I once read that it's not a good programming style to #include in header files, where structs, typedefs or functions are declared. Just to illustrate:
/* foo.h */
#ifndef FOO_H
#define FOO_H
extern int foo1(int, int);
extern double foo2(double, double);
#endif
/* foo.c */
#include "foo.h"
/* here to include any other necessary headers */
int foo1(int x, int y)
{
...
}
double foo2(double x, double y)
{
...
}
What to do if, say, a function declared has one of parameters of type 'size_t'. This type is defined in stddef.h, so incusion of this file is inevitable:
/* foo.h */
extern void foo3(char *, size_t);
...
Is there a common way to workaround this, or it is perfectly well to have file included in the headers?
Thanks.
--
Mark