Topic: (re-)declarations and default arguments


Author: rfg@netcom.com (Ronald F. Guilmette)
Date: Fri, 22 Apr 1994 19:26:28 GMT
Raw View
In article <2p2r9u$8cv@liberator.et.tudelft.nl> mario@leonardo.et.tudelft.nl (Mario Konijnenburg) writes:
>There are compilers which generate an error when the following test-program is
>compiled. They don't like two initializers for the function foo.
>But other compilers do not complain! These compilers only complain when the
>specifier 'extern' is removed.
>The ARM does not give any clue for this problem.

Yes, it does... although not in terribly clear prose.

>Question: Is the following example a legal construction? Which compiler is
>          wrong?

The ones that fail to flag the error.

>Example:
>int foo( int val=1 );
>
>extern int foo( int val=1 );
--

-- Ron Guilmette, Sunnyvale, CA ---------- RG Consulting -------------------
---- domain addr: rfg@netcom.com ----------- Purveyors of Compiler Test ----
---- uucp addr: ...!uunet!netcom!rfg ------- Suites and Bullet-Proof Shoes -




Author: mario@leonardo.et.tudelft.nl (Mario Konijnenburg)
Date: 20 Apr 1994 09:06:06 GMT
Raw View
There are compilers which generate an error when the following test-program is
compiled. They don't like two initializers for the function foo.
But other compilers do not complain! These compilers only complain when the
specifier 'extern' is removed.
The ARM does not give any clue for this problem.
Question: Is the following example a legal construction? Which compiler is
          wrong?

Example:
int foo( int val=1 );

extern int foo( int val=1 );

main()
{
  foo();
}

int foo( int /*=1*/ )
{
   /* definition */
}

Thanks in advance,
Mario Konijnenburg

--
==============================================================================
| Mario Konijnenburg                     phone(work): (0)15 786177           |
| Delft University of Technology         fax:         (0)15 784898           |
| Faculty of Electrical Engineering      email: mario@leonardo.et.tudelft.nl |
| Section of Computer Architecture and Digital Technique (Test Group)        |
| P.O. Box 3051        2600 GA Delft          The Netherlands                |
==============================================================================