C and lint: default declarations

Jeffrey W Percival jwp at larry.UUCP
Sat Jan 21 07:24:16 AEST 1989


At the risk of starting some kind of style war, let me raise a
question.  I've always been a bit bothered by this aspect of C:

    Subroutines and return types must be declared in the
    calling routine, unless if it returns an integer, and
    then you can just forget about it.

I mean, either declarations are important or they're not, right?  Now,
before you call me a ninny let me point out that I know why other types
must be declared (stacks and all that), and because only one type is
excused, the compiler is not really at a loss to know what's going on.

Some of the scope rules also seem a bit loose.  Probably for historical
reasons, I'll wager.

The question is, do "good" programmers typically take advantage of these
concessions, or do they assiduously declare their integer functions and
keep their "scopes" as collapsed as possible?

The second part of the question concerns lint.  I wish lint had a
"strict" mode, where it would not assume such things.  For clarity for
future browsers, if nothing else, it would be nice to be told that a
declaration is missing, even if the compiler can figure it out.

Does anyone have a lint-like tool that does not pander to these
"forgiving" scope rules and default declarations?
-- 
Jeff Percival (jwp at larry.sal.wisc.edu)



More information about the Comp.unix.questions mailing list