This has been bugging me for a while, but I'm reasonably confident I've got things figured out. Here's how I plan to do things from now on.
IN HEADERS:
- struct definitions
- prototypes of functions that are to be used by other files
- declaration of variables that other files should have access to (hopefully not too many)
IN C FILE:
- prototypes of "helper" functions (ie functions not to be used by other files)
- global variable declarations that should not be accessed outside this file
- implementations of each function (obviously)
The variables and functions declared in the header should also have the docs (ie describe how the functions are used in the header, not the c file). The functions and variables declared in the C file should all be static.
Okay, that's it. I'm trying to convert my (currently lousy) C programming into a more object-oriented style, where the headers contain just an interface. How does all this sound? In my previous programs, I've put ALL function prototypes in the header file, but I've come to the conclusion that this is a bad idea. Have I screwed anything up? Left anything out?
Thanks,
Just