[lug] C programming Q.
Michael J. Hammel
mjhammel at graphics-muse.org
Wed Apr 17 12:59:59 MDT 2002
Thus spoke rm at fabula.de
> No, this is a _good_ habbit, really ;-) Since i made this the default
> in my projects (and cranked up the warning switches) i had way less
> bugs sneak into my production code.
It's good if you're just learning programming, perhaps. Mostly, it gets in
my way. So far, I've only found one real bug in the code (written by
someone who obviously thinks in objects). The majority have been prototype
mismatches. How often does a missing prototype cause serious problems on a
given system (ignoring portability for the time being)?
Not that it matters much to me either way. Fixing these is easy for the
most part. It just delays me from spending time doing real development.
> Well, a pointer to 'int f(uint *val1, uint *val2, uint count);' _is_ different
> from a pointer to 'int f(void)'.
But how often does this cause a serious run time error? Changing it is
easy of course. I've had so few problems not specifying *any* arguments
in prototypes that this issue seems like busy work more than better coding.
I suspect that the real issue here is how compatible the definition would
be using different compilers. If you're using a single compiler (gcc, for
example), I'd think it would be fairly irrelevant.
> Hope that helps
It does. It was actually what I suspected, but since I'd never mucked with
it before, I thought I'd ask before I made lots of changes.
Thanks to everyone who offered pointers (so to speak).
--
Michael J. Hammel The Graphics Muse
mjhammel at graphics-muse.org http://www.graphics-muse.com
------------------------------------------------------------------------------
Got a full 6-pack, but lacks the plastic thing to hold it all together.
-- From a real employee performance evaluation.
More information about the LUG
mailing list