[prog] [C/C++] what to put in header files.

Terri Oda terri at zone12.com
Thu Sep 26 20:58:29 EST 2002


> This allows them to write all of their code as they normally would (placing 
> interface definitions in the .h file while placing the implementation in 
> the .c file), except for the one #include line, keep compilation simple. 
> Presumably they teach them later how to compile "properly". I don't think 
> it's very good to do, but many teachers do it.

I'm pretty sure that you're right, and that's what he was trying to do, but
some of the compilers available in the labs simply refused to compile a
header file, and others that could handle that would only recompile their
"workspaces" when the header file was changed because they didn't monitor
the #include'd files.

Though I'm sure the prof was honestly trying to make things simpler for his
students, the end result was that only those who already knew how to compile
or had a friend who already knew how to compile, or were fortunate enough to
choose something else (eg gcc) as their compiler of choice early on were
able to handle his strange demands.  The poor teaching assistants...

And of course, when you think about it, what was propsed is no easier than
compiling the source file and #include'ing the header.  Even if the
assumptions of the compilers hadn't gotten in the way, it wouldn't have been
a better choice. 

 Terri



More information about the Programming mailing list