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

C/C++Èí¼þ¹¤³Ìʦ±ÊÊÔÌâ

 
C/C++±ÊÊÔÌâϵÁÐ
Ô¤´¦ÀíÆ÷£¨Preprocessor£©
1. ÓÃÔ¤´¦ÀíÖ¸Áî#define ÉùÃ÷Ò»¸ö³£Êý£¬ÓÃÒÔ±íÃ÷1ÄêÖÐÓжàÉÙÃ루ºöÂÔÈòÄêÎÊÌ⣩
#define SECONDS_PER_YEAR (60 * 60 * 24 * 365)UL
ÎÒÔÚÕâÏë¿´µ½¼¸¼þÊÂÇ飺
1). #define Óï·¨µÄ»ù±¾ÖªÊ¶£¨ÀýÈ磺²»ÄÜÒԷֺŽáÊø£¬À¨ºÅµÄʹÓ㬵ȵȣ©
2). ¶®µÃÔ¤´¦ÀíÆ÷½«ÎªÄã¼ÆËã³£Êý±í´ïʽµÄÖµ£¬Òò´Ë£¬Ö±½Óд³öÄãÊÇÈçºÎ¼ÆËãÒ»ÄêÖÐÓжàÉÙÃë¶ø²»ÊǼÆËã³öʵ¼ÊµÄÖµ£¬ÊǸüÇåÎú¶øûÓдú¼ÛµÄ¡£
3). Òâʶµ½Õâ¸ö±í´ïʽ½«Ê¹Ò»¸ö16λ»úµÄÕûÐÍÊýÒç³ö-Òò´ËÒªÓõ½³¤ÕûÐÍ·ûºÅL,¸æËß±àÒëÆ÷Õâ¸ö³£ÊýÊǵij¤ÕûÐÍÊý¡£
4). Èç¹ûÄãÔÚÄãµÄ±í´ïʽÖÐÓõ½UL£¨±íʾÎÞ·ûºÅ³¤ÕûÐÍ£©£¬ÄÇôÄãÓÐÁËÒ»¸öºÃµÄÆðµã¡£¼Çס£¬µÚÒ»Ó¡ÏóºÜÖØÒª¡£
2. дһ¸ö¡°±ê×¼¡±ºêMIN£¬Õâ¸öºêÊäÈëÁ½¸ö²ÎÊý²¢·µ»Ø½ÏСµÄÒ»¸ö¡£
#define MIN(A,B) ((A)


Ïà¹ØÎĵµ£º

gdbµ÷ÊÔC¡¢C++³ÌÐòʹÓÃÊÖ²á

Ò»¡¢¼ò½é
        µ÷ÊÔÆ÷(±ÈÈçÏóGDB)ÄÜÈÃÄã¹Û²ìÁíÒ»¸ö³ÌÐòÔÚÖ´ÐÐʱµÄÄÚ²¿»î¶¯£¬»ò³ÌÐò³ö´íʱ·¢ÉúÁËʲô¡£GDBÖ÷ÒªÄÜΪÄã×öËļþÊÂ(°üÀ¨ÎªÁËÍê³ÉÕâЩʶø¸½¼ÓµÄ¹¦ÄÜ)£¬°ïÖúÄãÕÒ³ö³ÌÐòÖеĴíÎó¡£
        * ÔËÐÐÄãµÄ³ÌÐò£¬ÉèÖÃËùÓеÄÄÜÓ°Ïì³ÌÐòÔËÐеĶ«Î÷¡ ......

(C/C++)ÖµµÃÑо¿µÄһЩº¯Êý

1. memcpyº¯ÊýµÄʵÏÖ
Ê×ÏȶÔÕâ¸öº¯Êý×öһЩ˵Ã÷¡£
#include <string.h>
void *memcpy(void *to, const void *from, size_t count)
º¯Êýmemcpy()´ÓfromÖ¸ÏòµÄÊý×éÏòtoÖ¸ÏòµÄÊý×鸴ÖÆcount¸ö×Ö·û¡£Èç¹ûÁ½Êý×éÖصþ£¬²»¶¨Ò庯ÊýµÄÐÐΪ¡£
ÔÚC99ÖУ¬toºÍfromÓÉrestrictÐÞÊΡ£
ÏÈÀ´¿´¿´Î¢ÈíµÄʵÏÖ£º
void * __cdecl m ......

C/C++ÖеÄÈÕÆÚºÍʱ¼ä time_tÓëstruct tm

 ±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê׼ʱ¼ä£©£¬Calendar Time£¨ÈÕÀúʱ¼ä£©£¬epoch£¨Ê±¼äµã ......

£¨×ª£©ÓÃVIM±àдC/C++³ÌÐò

ÓÃVIM±àдC/C++³ÌÐò£¨×ªÔØ£©
ÓÃVIM±àдC/C++³ÌÐò
ViÊÇUnixÏÂ×î³£ÓõÄÎı¾±à¼­Æ÷¡£VIM£¨Vi IMproved£©ÔòÊÇËüµÄÔöÇ¿°æ¡£ÓÐÈ˳£³£ÄÃVIMºÍemacs±È½Ï£¬VIM¾¡¹Ü²»ÏóemacsÄÇÑùÓÐÄÇô¶àµÄ¹¦ÄÜ£¬µ«ÊDZÈemacs¸ü·½±ã¡¢ºÃÓá£ÓùýemacsµÄÈ˿϶¨»áΪemacsµÄһЩ¿ì½Ý¼ü¸Ðµ½·³ÄÕ£¬ÓÐʱºòÓÃÕæÏ£Íû×Ô¼ºÓаËÖ»ÊÖ¡£VIMµÄѧϰÇúÏßÒ²²»ÏóemacsÄ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ