PRB: Program Example for Signal() Generates C4113

ID Number: Q81890

1.00

WINDOWS

docerr

Summary:

SYMPTOMS

When using the Microsoft QuickC for Windows (QC/Win) Graphical

Development Environment version 1.0, compiling the program example

for the signal function given in the online help generates the

following warning errors:

SIGNAL.C(42) : warning C4113: function parameter lists differed

SIGNAL.C(85) : warning C4113: function parameter lists differed

Signal handler functions that compiled correctly under earlier

versions of Microsoft C or QuickC will also generate the same type

of errors.

CAUSE

SIGNAL.H that came with C 6.0 and QuickC 2.5 prototypes the

function:

void (_FAR_ _cdecl _LOADDS_ * _FAR_ _cdecl signal(int,

void (_FAR_ _cdecl _LOADDS_ *)()))();

However, the SIGNAL.H that came with QC/Win prototypes it as

follows:

void (_FAR_ __cdecl _LOADDS_ * _FAR_ __cdecl signal(int,

void (_FAR_ __cdecl _LOADDS_ *)(int)))(int);

The difference between the actual prototypes in QC/Win and the

earlier compilers is that QC/Win requires that the signal handler

function be passed an integer that is the value of the interrupt

being handled. Because of this change, the function prototype and

definition for the new signal handler in the program example

(originally taken from the previous version of the compiler) must

be modified to have at least one parameter (out of two possible).

RESOLUTION

To work around the problem, make the following changes to the

code example

1. Change the new handler prototype on line 33 of the program

example to:

void __cdecl ctrlchandler( int );

2. Change the new handler definition on lines 67-69 of the program

example to:

void __cdecl ctrlchandler( int ch )

{

/*int ch;*/ /* ch is now a parameter rather than a

local variable. */

STATUS

Microsoft has confirmed this to be a problem in QuickC for Windows

version 1.0. We are researching this problem and will post new

information here as it becomes available.

More Information:

Please note that attempting to compile this code with previous

versions of the compiler will generate three errors because __cdecl is

a new keyword in this version of the compiler. Earlier versions of

this keyword contain only one underscore prefixing the name.

Additional reference words: signal c4113 qcwin example qcw 1.00