20100527 CÏÝÚåÓëȱÏݶÁÊé±Ê¼Ç£¨Ò»¡¢¶þÕ£©
µÚÒ»Õ£º´Ê·¨“ÏÝÚå”
×Öĸ±¾ÉíûÓÐÒâ˼£¬µ«Êǽ«×Öĸ×é³ÉµÄµ¥´Ê¾Í±»¸³ÓèÁËÒâÒå¡£ÔÚCÓïÑÔÖУ¬×Ö·û×éºÏ³ÉÁËÕû¸ö´úÂ룬ÓÉ×Ö·ûÊéд´øÀ´µÄ±ÊÎó»á´øÀ´²»ÉÙÂé·³¡£×÷Ϊ³ÌÐòÔ±£¬²»ÄÜÖ¸Íû¿¿±àÒëÆ÷À´ÌáÐÑ¡£Òò´Ë£¬ÐèҪעÒ⣺
1.CÓïÑÔÖУ¬·ûºÅÖ®¼äµÄ¿Õ°×£¨°üÀ¨¿Õ¸ñ·û£¬ÖƱí·û£¬»»Ðзû£©½«±»ºöÂÔ¡£
2.¸³ÖµÓï¾äÊÇ=£¬Ò»¸öµÈºÅ¡£¹ØϵÔËËã“ÏàµÈ”ÊÇ==£¬2¸öµÈºÅ¡£µ±±äÁ¿ºÍ³£Á¿Ïë±È½Ïʱ£¬¿ÉÒÔ½«³£Á¿ÊéдÔÚÇ°Ã棬±ÜÃâÊéд´íÎó¡£
3.&ÊÇÂß¼ÔËË㰴λÓ룬&&ÊÇÂß¼ÔËËãÓ룬|ÊÇÂß¼ÔËË㰴λ»ò£¬||ÊÇÂß¼ÔËËã»ò
4.ΪÁ˱ÜÃâ×Ö·û¶þÒåÐÔ£¬Ó¦¸Ã׼ȷ±í´ï£¬ÀýÈç¿ÉÒÔ¼ÓÈ루£©µÈ¡£ÅжÏÊÇ·ñΪ0ʱ£¬Ò²½«Ìõ¼þдÈë¡£
5.Èç¹ûÒ»¸öÕûÐγ£Á¿µÄµÚÒ»¸ö×Ö·ûÊÇ0£¬ÄÇô¸Ã³£Á¿±»ÊÓΪ8½øÖÆÊý¡£
6.Óõ¥ÒýºÅÒýÆðµÄÒ»¸ö×Ö·ûʵ¼ÊÉÏ´ú±íÁËÒ»¸öÕûÊý¡£ÓÃË«ÒýºÅÒýÆðµÄ×Ö·û´®£¬ÊÇÒ»¸öÖ½ÏäÎÞÃûÊý×éÆðʼ×Ö·ûµÄÖ¸Õë¡£
µÚ¶þÕ£ºÓï·¨“ÏÝÚå”
ÒªÀí½âÒ»¸öC³ÌÐò£¬½ö½öÀí½â×é³É¸Ã³ÌÐòµÄ·ûºÅÊDz»¹»µÄ¡£ÓÐʱºòһЩ¶¨ÓÚÓëÈËÃǵÄÖ±¾õÏà㣣¬»òÕßÈÝÒ×ÒýÆð»ìÏý¡£
ÈκÎC±äÁ¿µÄÉùÃ÷¶¼ÓÐÁ½²¿·Ö×é³É£ºÀàÐÍÒÔ¼°Ò»×éÀÛËÀ±í´ïʽµÄÉùÃ÷·û¡£ÉùÃ÷·û´Ó±íÃæÉÏ¿´Óê±í´ïʽÓÐЩÀàËÆ¡£Ò»µ©ÖªµÀÁËij¸öÉùÃ÷£¬ÄÇô¸ÃÀàÐ͵ÄÀàÐÍת»»·ûÒ²¾ÍÈÝÒ׵õ½ÁË£ºÖ»ÐèÒª½«ÉùÃ÷ÖеıäÁ¿ÃûºÍÉùÃ÷ĩβµÄ·ÖºÅÈ¥µô£¬ÔÙ½«Ê£ÓàµÄ²¿·ÖÓÃÀ¨ºÅ·â×°ÆðÀ´¡£
CÓïÑÔµÄÓÅÏȼ¶£º
ÀàÐÍ
ÔËËã·û
½áºÏÐÔ
²»ÊÇÔËËã·û
() [] ->
.
×Ô×óÏòÓÒ
µ¥Ä¿ÔËËã·û
! ~ ++ -- - (type) * & sizeof
×ÔÓÒÏò×ó
ËãÊõÔËËã·û
* / %
×Ô×óÏòÓÒ
+ -
×Ô×óÏòÓÒ
λÒÆÔËËã·û
<<
>>
×Ô×óÏòÓÒ
¹ØϵÔËËã·û
<
<= > >=
×Ô×óÏòÓÒ
== £¡=
×Ô×óÏòÓÒ
Âß¼ÔËËã·û
&
×Ô×óÏòÓÒ
^
×Ô×óÏòÓÒ
|
×Ô×óÏòÓÒ
&&
×Ô×óÏòÓÒ
||
×Ô×óÏòÓÒ
Ìõ¼þÔËËã·û
?:
×ÔÓÒÏò×ó
¸³ÖµÔËËã·û
assignments
×ÔÓÒÏò×ó
¶ººÅÔËËã·û
Óï¾ä½áβ´¦µÄ·ÖºÅҪעÒâ¡£
switchÓï¾äµÄbreakҪעÒâ¡£
if Óï¾äÖÐelse×ÜÓëδÅä¶Ôµ
Ïà¹ØÎĵµ£º
ÔÚÖƶ¨±ê׼ʱ£¬
C89
ίԱ»á¹Ø×¢ÏÂÁм¸¸öÔÔò£¬ÕâЩÔÔòÖ±µ½½ñÌ컹ÔÚÖ¸µ¼ÎÒÃÇ¿¼ÂÇÎÊÌâ¡£×îÖØÒªµÄ¼¸¸öÔÔòÈçÏ£º
ÏÖ´æ´úÂëºÜÖØÒª£¬¶øÏÖ´æµÄ
C
±àÒëÆ÷ʵÏÖ²¢²»ÖØÒª¡£
C
´úÂëÄܹ»ÊÇ¿ÉÒÆÖ²µÄ¡£
C
´úÂë¿ÉÒÔÊDz»¿ÉÒÆÖ²µÄ¡£
C89
ίԱ»á²»Ï£Íû×èÖ¹
C
³ÌÐòԱд»úÆ÷רÓôúÂ룬ÒòΪÕâÊÇ
C
µÄÒ»¸öÇ¿Ïî¡£ÕâÔì³ÉÁËÑϸñÒ» ......
1. ʹÓÃTCHARÀàÐÍ£¬¶¨ÒåÔÚtchar.hÖÐ
#include <tchar.h>
#include <stdio.h>
int main()
{
TCHAR s[] = "Äã";
printf("%s \n",s);
return 0;
}
2.¹ØÓÚC++ÖÐÎÄ×Ö·ûµÄ´¦Àí
Ò» ÒýÈëÎÊÌâ
´úÂë wchar_t a[3]=L”Öйú”£¬±àÒëʱ³ö´í£¬³ö´íÐÅϢΪ£ºÊý×éÔ½½ç¡£µ«wchar_ ......
ÔÚ´Ëժ¼C±àÒëʱ³öÏֵľ¯¸æÐÅÏ¢µÄÒâÒå¡£
1) warning: ISO C90 forbids mixed declarations and code
CÓïÑÔÊÇÃæÏò¹ý³ÌµÄÓïÑÔ£¬Õâ¸ö¾¯¸æͨ³£±íʾÉùÃ÷Ó¦¸ÃÔÚÆäËû´úÂëµÄÇ°Ãæ¡£
2) warning: initialization from incompatible pointer type
ÔÚLinux kernelÖÐÓÐÐí¶àcallbackº¯Êý£¬Õâ¸ö¾¯¸æ±íÃ÷callbackº¯ÊýµÄʵÏÖÖУ¬»òÕß·µ ......
×î½ü×öµÄһЩ¹¤×÷ÐèÒªÓõ½Ï̳߳ؼ¼Êõ£¬Òò´Ë²Î¿¼ÁËһЩ×ÊÁϺÍÊé¼®£¬È硶0bug c/c++ÉÌÓù¤³ÌÖ®µÀ¡·¡£
Ϊ´ËÔÚlinuxƽ̨ÉÏÓô¿cдÁËÒ»¸öÏ̳߳صÄʵÏÖ¡£
ÔÚ´ËÁгöÁËÔ´úÂë¡£
Ö÷ÒªÓõ½µÄÊý¾Ý½á¹¹ÓÐ
1.struct thread_pool_t // thread pool µÄʵÏÖ´úÂë
2.struct thread_pool_token_t &nb ......
server:
import sys
import socket
host = sys.argv[1]
port = int(sys.argv[2])
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((host,port))
while 1:
try:
&n ......