CÕûÐÍÉý¼¶ºÍÑ°³£ËãÊõת»»
ANSI CÖеÄÕûÐÍÉý¼¶
char£¬short int»òÕßintÐÍλ¶Î£¨bit-field£©£¬°üÀ¨ËüÃǵÄÓзûºÅ»òÎÞ·ûºÅ±äÐÍ£¬
ÒÔ¼°Ã¶¾ÙÀàÐÍ£¬¿ÉÒÔʹÓÃÔÚÐèÒªint»òunsigned intµÄ±í´ïʽÖУ¬
Èç¹ûint¿ÉÒÔÍêÕûµØ±íʾԴÀàÐ͵ÄËùÓÐÖµ£¬ÄÇô¸ÃÀàÐ͵ÄÖµ¾Íת»»Îªint£¬·ñÔòת»»Îªunsigned int¡£
ANSI CÖеÄÑ°³£ËãÊõת»»
µ±Ö´ÐÐËãÊõÔËËãʱ£¬²Ù×÷ÊýµÄÀàÐÍÈç¹û²»Í¬£¬¾Í»á·¢Éúת»»¡£
Êý¾ÝÀàÐÍÒ»°ã³¯×Ÿ¡µã¾«¶È¸ü¸ß¡¢³¤¶È¸ü³¤µÄ·½Ïòת»»£¬
ÕûÐÍÊýÈç¹ûת»»Îªsigned²»»á¶ªÊ§ÐÅÏ¢£¬¾Íת»»Îªsigned£¬·ñÔò¾Íת»»Îªunsigned¡£
Õâ¸ö³ÆΪֵ±£Áô£¨value preserving£©ÔÔò£¬ÓëK&R CËù²ÉÓõÄÎÞ·ûºÅ±£Áô£¨unsigned preserving£©ÔÔò²»Í¬¡£
¸¡µãÀà:
Èç¹ûÒ»¸ö²Ù×÷ÊýµÄÀàÐÍÊÇlong double£¬ÄÇôÁíÒ»¸ö²Ù×÷ÊýÎÞÂÛÊÇʲôÀàÐͶ¼½«±»×ª»»³Élong double¡£
Èç¹ûÁ½¸ö²Ù×÷Êý¶¼²»ÊÇlong doubleÐÍ£¬ÄÇôµ±ÆäÖÐÒ»¸ö²Ù×÷ÊýµÄÀàÐÍÊÇdoubleÐÍ£¬ÔòÁíÒ»¸ö¾Í½«±»×ª»»³Édouble ÐÍ¡£
Èç¹ûÁ½¸ö²Ù×÷Êý¶¼²»ÊÇdoubleÐÍ£¬¶øÆäÖÐÒ»¸ö²Ù×÷ÊýÊÇfloatÐÍ£¬ÔòÁíÒ»¸ö±»×ª»»³ÉfloatÐÍ¡£
×¢Ò⣺doubleºÍfloat¶¼²»¿ÉÓÃunsigned,shortÐÞÊΣ¬ÁíÍâfloat»¹²»¿ÉÓÃlongÐÞÊÎ
ÕûÐÎÀà¹æ:
·ñÔò£¬Á½¸ö²Ù×÷Êý¶¼²»ÊÇÈýÖÖ¸¡µãÀàÐÍÖ®Ò»£¬ËüÃÇÒ»¶¨ÊÇijÖÖÕûÖµÀàÐÍ¡£ÔÚÈ·¶¨¹²Í¬µÄÄ¿±êÌáÉýÀàÐÍ֮ǰ£¬±àÒëÆ÷½«ÔÚËùÓÐСÓÚintµÄÕûÖµÀàÐÍÉÏÊ©¼ÓÒ»¸ö±»³ÆΪÕûÖµÌáÉý(integral promotion)µÄ¹ý³Ì¡£ÔÚ½øÐÐÕûÖµÌáÉýʱ£¬ÀàÐÍ(char¡¢signed char¡¢unsigned charºÍshort¡¢int)¶¼±»ÌáÉýΪÀàÐÍint¡£Èç¹û»úÆ÷ÉϵÄintÐÍ×ã¹»±íʾËùÓÐunsigned¡¢shoftÐ͵ÄÖµ(Õâͨ³£·¢ÉúÔÚshortÓðë¸ö×Ö±íʾ£¬¶øintÓÃÒ»¸ö×Ö±íʾµÄÇé¿öÏÂ)£¬Ôòunsigned short intÒ²±»×ª»»³Éint£¬·ñÔòËü»á±»ÌáÉýΪunsigned int¡£
wchar_tºÍö¾ÙÀàÐͱ»ÌáÉýΪÄܹ»±íʾÆäµ×²ãÀàÐÍ(underlying type)ËùÓÐÖµµÄ×îСÕûÊýÀàÐÍ¡£
Ò»µ©ÕûÖµÌáÉýÖ´ÐÐÍê±Ï£¬ÀàÐͱȽϾÍÓÖÒ»´Î¿ªÊ¼¡£Èç¹ûÒ»¸ö²Ù×÷ÊýÊÇunsigned longÐÍ£¬ÔòµÚ¶þ¸öÒ²±»×ª»»³Éunsigned longÐÍ¡£Èç¹ûÁ½¸ö²Ù×÷ÊýµÄÀàÐͶ¼²»ÊÇunsigned long£¬¶øÆäÖÐÒ»¸ö²Ù×÷ÊýÊÇ
Ïà¹ØÎĵµ£º
²Ù×÷ϵͳµÄÒ»¸ö¾µäÎÊÌâÊÇ"Éú²úÕß-Ïû·ÑÕß"ÎÊÌâ, ÕâÉ漰ͬ²½ÐźÅÁ¿ºÍ»¥³âÐźÅÁ¿µÄÓ¦ÓÃ, ÔÚÕâÀï,ÎÒÓÃÏ̵߳Äͬ²½ºÍ»¥³âÀ´ÊµÏÖ.
/*
* author ÕÅÎÄ
* 2008/06/20
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h> ......
1.ÒýÑÔ
¡¡¡¡C++ÓïÑԵĴ´½¨³õÖÔÊÇ“a better C”£¬µ«ÊÇÕâ²¢²»Òâζ×ÅC++ÖÐÀàËÆCÓïÑÔµÄÈ«¾Ö±äÁ¿ºÍº¯ÊýËù²ÉÓõıàÒëºÍÁ¬½Ó·½Ê½ÓëCÓïÑÔÍêÈ«Ïàͬ¡£×÷ΪһÖÖÓûÓëC¼æÈݵÄÓïÑÔ£¬C++±£ÁôÁËÒ»²¿·Ö¹ý³ÌʽÓïÑÔµÄÌص㣨±»ÊÀÈ˳ÆΪ“²»³¹µ×µØÃæÏò¶ÔÏ󔣩£¬Òò¶øËü¿ÉÒÔ¶¨Òå²»ÊôÓÚÈκÎÀàµÄÈ«¾Ö±äÁ¿ºÍº¯Êý¡£µ«ÊÇ£¬C++±Ï¾ ......
×ÔÓɵĸèÒ¥
¡¡¡¡±¾ÊéÊÇ×ÔÓÉÈí¼þ´ÔÊéµÄÒ»²¿·Ö£¬Ò²ÊÇÒ»Ê××ÔÓɵĸèÒ¥¡£
¡¡¡¡±¾ÊéÖвûÊöµÄGNU C¿â£¬¶¨ÒåÁËËùÓÐÔÚISO C±ê×¼Ëù¹æ¶¨µÄ£¬ÒÔ¼°POSIX±ê×¼¡¢ÆäËüÏà¹Ø±ê×¼ºÍUNIXϵͳËùÅÉÉúµÄ±ê×¼Öж¨ÒåµÄËùÓк¯Êý£¬ÎªGNU²Ù×÷ϵͳËùÖ§³Ö¡£
C³ÌÐòÉè¼ÆÓïÑÔÌṩÖîÈçÊäÈë/Êä³ö¡ ......
1. ×¼±¸¹¤×÷£º
¿ª·¢°åµÄipÉèÖÃ
gzsd> net set ipaddr 192.168.0.11 ÉèÖÿª·¢°åµÄIP
gzsd> net set serverip 192.169.0.10 ÉèÖÃtftp serverµÄIP
gzsd> net set netmask 255.255.255.0 ÉèÖÃ×ÓÍøÑÚÂë
gzsd> net save ±£´æÉèÖÃ
gzsd> net ping XXX ²âÊÔÁ¬½Ó×´¿ö
°²×°tftp·þÎñÆ÷
windowsÏÂ
ÔËÐйâÅ̹¤¾ß ......
¡¾checkpass.c¡¿
#include <stdio.h>
#include <string.h>
int checkpass(void){
int x;
char a[9];
x = 0;
fprintf(stderr,"a at %p and\nx at %p\n", (void *)a, (void *)&x);
printf("Enter a short word: ");
&nbs ......