KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q67080: Functions in Function Prototypes Cannot Have Typedef Arguments

Article: Q67080
Product(s): See article
Version(s): 5.10 6.00 6.00a | 5.10 6.00 6.00a
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | S_QUICKC buglist5.10 buglist6.00 buglist6.00a | mspl13_c
Last Modified: 4-DEC-1990

According to the ANSI specification, types and typedefs should both be
able to exist interchangeably in function prototypes, and the
Microsoft C and QuickC compilers do allow function prototypes to
include typedefs in the parameter type list. However, the compilers do
not allow parameters to functions or function pointers within the type
list to have typedef'd parameters. For example, given the following
declarations

   typedef int FirstType;
   typedef int SecondType;
   int foo( int, FirstType, int *( SecondType ) );

the compilers have no problem with "FirstType" but they will halt with
an error when they reach "SecondType".

Although the syntax is correct according to ANSI, the compilers
incorrectly generate the following error when they encounter the
second typedef:

   error C2061: syntax error : identifier 'SecondType'

Microsoft has confirmed this to be a problem in C versions 5.10, 6.00,
and 6.00a and QuickC versions 2.00, 2.01, 2.50, and 2.51 (buglist2.00,
buglist2.01, buglist2.50, and buglist2.51). We are researching this
problem and will post new information here as it becomes available.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.