Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

c signalµ÷ÓÃÎÊÌâ

¿ªÊ¼Ñ§OS,°´Á·Ï°ÒªÇóдµÄ´úÂëÔÚgccÏÂÎÞ·¨±àÒ룺

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>

void SIGFPEhandler2(int sig1) {
    printf("1");
    signal(SIGFPE, SIGFPEhandler1);
    exit(EXIT_SUCCESS);
}

void SIGFPEhandler1(int sig2) {
    signal(SIGFPE, SIGFPEhandler2);
    printf("2");
    exit(EXIT_SUCCESS);
}


int DBZ(int i) {
    return i/0;
}

int main(void) {
  (void) signal(SIGFPE, SIGFPEhandler1);
    DBZ(5);
    return EXIT_SUCCESS;
}


Ä¿µÄÈÃsignal handlerµ÷ÓÃÁíÒ»¸ö handler£¬¶¼ÊÇ´¦ÀíͬÑùµÄsignal¡£±àÒëÌáʾSIGFPEhandler1 undeclare.

ÊÇÎÒʵÏֵķ½·¨²»¶Ô»¹ÊÇhandler²»Äܵ÷Óô¦ÀíͬÑùsignalµÄhandler? Íû´ó¼ÒÖ¸Õý¡£

ÔÚlinuxÏÂÂð£¿

windowsÏÂ, ÓõÄCygwin.


ÔÚSIGFPEhandler2 Ç° ÉùÃ÷ SIGFPEhandler1

º¯ÊýȱÉÙÇ°ÖÃÉùÃ÷
¼Ó
void SIGFPEhandler1(int sig2);
void SIGFPEhandler2(int sig1);
ÔÚÎļþÍ·ºó

ÒýÓÃ
ÔÚSIGFPEhandler2 Ç° ÉùÃ÷ SIGFPEhandler1

±àÒë²»ÄÜͨ¹ý£¬ SIGFPEhandler2 undeclared.

ÒýÓÃ
º¯ÊýȱÉÙ


Ïà¹ØÎÊ´ð£º

ÇëÍƼö»ù±¾ C µÄºÃÊé

RT
c³ÌÐòÉè¼ÆÓïÑÔ

C³ÌÐòÉè¼Æ̶ºÆÇ¿µÄÄDZ¾

c³ÌÐòÉè¼ÆÓïÑÔ
cÏÝÚåÓëȱÏÝ
CºÍÖ¸Õë
C primer plus
cר¼Ò±à³Ì

CÓïÑÔÖ®ËÄÊéÎå¾­

ǧÍò²»Òª¿´Ì·ºÆÇ¿µÄ£¬»áº¦ËÀÄã¡£
Ö±½Ó¿´The C Programming Lang ......

c LINUX ÎÊÌâ

GCCÊÇÃâ·ÑµÄÂð£¿ÄÇÓУ¿

LINUXϵͳÔõôװ£¿


ÖÐÎÄÔõôÉèÖã¿
Äã×°ÍêLinuxϵͳ¾Í»á×Ô´øGCC£¬windowsÏÂÒ²ÓÐGCC£¬±ÈÈçdev-c++,CODE::Blocks
linuxϵͳ°²×°¸ù¾Ý²»Í¬µÄlinux°æ±¾ÍøÉ϶¼Óн̳̣¬¿´ÏÂ¾Í ......

ÇëÎÊC/SµÄÎïÀí½á¹¹£¿

ÇëÎÊÏÂC/SµÄÎïÀí½á¹¹£¬ÊDz»ÊÇÕâÑùµÄ£º

һ̨·þÎñÆ÷£¬ÉÏÃæÖ»ÔËÐÐÒ»¸öÊý¾Ý¿â£¬È»ºóÊǶà¸ö¿Í»§¶Ë»ú£¬Ã¿¸ö»ú×ÓÉÏ°²×°Ò»¸ö¿Í»§¶ËÈí¼þ£¬ÔÙ°ÑÊý¾Ý¿âÁ¬½ÓÓû§ÃûÃÜÂë¸øÿ¸ö¿Í»§¶Ë£¬Õâ¸öÃÜÂëÓÉÈí¼þ¼ÓÃÜ·ÅÔÚ¿Í»§¶Ë£¬Óû§µ ......

ѧϰÌÖÂÛ C/C++ QQȺ - C/C++ / ·Ç¼¼ÊõÇø

QQȺ 29152388
ÓÑÇéUP

°ï¶¥

up

°ïup

up Ö§³Ö£¡

up jf

...ÄѵÀÓзÖ..?

up up up
Ï£ÍûÓеüӷ֣¬¹þ¹þ¡£

Ö§³Ö£¬ÎÒ¼ÓÁË£¬Ï£ÍûÂ¥Ö÷ÄܼÓÎÒ£¬¹²Í¬Ñ§Ï°¹þ

¼ÓÁË¡£

¶¥ÉÏ£¬Ã¿ÌìÊÕ»ñÒ»µã£¬Ö§³Ö ......

c/s ºÍb/sµÄÇø±ðÊÇʲô£¬Ò»Ö±¸ã²»Çå

c/s ºÍb/s µÄÇø±ðÊÇʲô£¬c/sÐèÒª·þÎñÆ÷Âð£¬ÔõôÅжϳÌÐòÊÇc/s »¹ÊÇb/s
C/SÊÇ·þÎñÆ÷ºÍ¿Í»§¶Ë    B/SÊÇ·þÎñÆ÷ºÍä¯ÀÀÆ÷

ËûÃǶ¼ÓÐs£¬Ê²Ã´ÊÇs?¾ÍÊÇserver
ÄÇËûÃǵÄÇø±ðÊÇʲô£¿Ò»¸öÊÇc£¬¼´client£¬Ò»¸ö ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ