abs (was: volatile isn't necessary, but it's there)

Karl Heuer karl at haddock.ISC.COM
Mon Apr 11 07:55:21 AEST 1988


In article <10171 at tut.cis.ohio-state.edu> lvc at tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes:
>In article <3377 at haddock.ISC.COM>, karl at haddock.ISC.COM (Karl Heuer) writes:
>> I just checked two systems (one BSD, one USGish), and neither declares the
>> abs() function in any header.  (Why should they?  The default declaration
>> suffices.$)
>
>What default declaration suffices for what?  The argument types need to
>be declared with a function prototype.  I could live without abs() being
>in <math.h> as long as it was in *some* header files.

The default declaration, "extern int abs();", which is automatically generated
by the compiler for any function which is used without a declaration in scope,
suffices on the two systems I mentioned, because (having no ANSI compiler nor
any other notion of prototypes) it conveys the same information as an explicit
declaration.  With ANSI C, the declaration becomes useful (assuming you find
automatic argument type conversion useful) and indeed it has an associated
header (as do all standard functions).

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list