TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Eric Weigel
from: Paul Edwards
date: 1995-05-07 09:56:56
subject: BCOS/2 1.0 signal() func

DH> MS>     void (__cdecl * __func)(int)

DH>I've declared and defined it as follows:

DH>void cbrk_handler(void);

DH>void cbrk_handler(void)

DH>Yet, I get an compiler error on:

DH>signal(SIGINT, cbrk_handler);

EW> And so you should.  The default function calling convention in BC for
EW> DOS was "cdecl".  BC OS/2 has a default of
"stdcall," which is supposed
EW> to be better.  The signal handler must be "cdecl." 
Declare and define
EW> as follows:

This is the exact same thing that Borland told me.  However, it
is completely wrong.  The ISO C standard governs how you write
a program that uses signal.  If you write your program according
to this standard, then the source file must compile with no
changes on that compiler.  There is no excuse.  Either your compiler
compiles it, or it isn't 100% ISO.  Nowhere does ISO say that you
need to use "cdecl".  In fact, quite the contrary, you're not
allowed to use "cdecl" because it is an undefined keyword.

BTW, Borland fixed the problem with BCOS2++ 1.5.  BFN.  Paul.
@EOT:

---
* Origin: Kludging up the works (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.