legal ANSI prototype?

brian_helterline brianh at hpcvia.CV.HP.COM
Wed Aug 29 07:18:39 AEST 1990


Hello netland,

I have a question regarding the ANSI interpretation of a prototype
declaration.  My compiler accepts it, but a pc-lint program does not.
I am interested in knowing which one is wrong.  Here it is:

extern intSomeFunction( int );

int main( void );
int main( void )
{
	int i = SomeFunction( 5 );
	return 0;
}

MSC takes this just fine but my pc-lint complains that SomeFunction
is called without a prototype being in scope.  If I add a space in the
prototype, then everybody is happy.  My question is
	1) is that prototype legal ANSI?
	2) Am I just lucky that MSC accepts it?
	3) Is my pc-lint broken because it misses it?

As to the reason why it is like that, some software I purchased the
following for prototypes:

#define IMPORT( t )	extern t

IMPORT( int )SomeFunction( int );
....

Thanks for your help.

-Brian



More information about the Comp.lang.c mailing list