Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : c++

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_t ÊÇÒ»¸ö¿í×Ö½ÚÀàÐÍ£¬Êý×éaµÄ´óСӦΪ6¸ö×Ö½Ú£¬¶øÁ½¸öºº×ֵĵÄunicodeÂëÕ¼4¸ö×Ö½Ú£¬ÔÙ¼ÓÉÏÒ»¸ö½áÊø·û£¬×î¶à6¸ö×Ö½Ú£¬ËùÒÔÓ¦¸Ã²»»áÔ½½ç¡£ÄѵÀÊDZàÒëÆ÷³öÎÊÌâÁË£¿
¶þ ½â¾öÒýÈëÎÊÌâËùÐèµÄ֪ʶ
   Ö÷ÒªÐèÁ½·½ÃæµÄ֪ʶ£¬µÚÒ»¸öΪ×Ö·ûÓÈÆäÊǺº×ֵıàÂ룬ÒÔ¼°ÓïÑԺ͹¤¾ßµÄÖ§³ÖÇé¿ö£¬µÚ¶þ¸öÊÇvc/c++ÖÐMutiByte Charater Set ºÍ Wide Character SetÓйØÄÚ´æ·ÖÅäµÄÇé¿ö.
Èý ºº×ֵıàÂ뷽ʽ¼°ÔÚvc/c++ÖеĴ¦Àí
1.ºº×Ö±àÂ뷽ʽµÄ½éÉÜ
¶ÔÓ¢ÎÄ×Ö·ûµÄ´¦Àí£¬7λASCIIÂë×Ö·û¼¯ÖеÄ×Ö·û¼´¿ÉÂú×ãʹÓÃÐèÇó£¬ÇÒÓ¢ÎÄ×Ö·ûÔÚ¼ÆËã»úÉϵÄÊäÈë¼°Êä³öÒ²·Ç³£¼òµ¥£¬Òò´Ë£¬Ó¢ÎÄ×Ö·ûµÄÊäÈë¡¢´æ´¢¡¢ÄÚ²¿´¦ÀíºÍÊä³ö¶¼¿ÉÒÔÖ»ÓÃͬһ¸ö±àÂ루ÈçASCIIÂ룩¡£
¶øºº×ÖÊÇÒ»ÖÖÏóÐÎÎÄ×Ö£¬×ÖÊý¼«¶à£¨ÏÖ´úºº×ÖÖнö³£ÓÃ×Ö¾ÍÓÐÁù¡¢Æßǧ¸ö£¬×Ü×ÖÊý¸ß´ï5Íò¸öÒÔÉÏ£©£¬ÇÒ×ÖÐθ´ÔÓ£¬Ã¿Ò»¸ ......

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_t ÊÇÒ»¸ö¿í×Ö½ÚÀàÐÍ£¬Êý×éaµÄ´óСӦΪ6¸ö×Ö½Ú£¬¶øÁ½¸öºº×ֵĵÄunicodeÂëÕ¼4¸ö×Ö½Ú£¬ÔÙ¼ÓÉÏÒ»¸ö½áÊø·û£¬×î¶à6¸ö×Ö½Ú£¬ËùÒÔÓ¦¸Ã²»»áÔ½½ç¡£ÄѵÀÊDZàÒëÆ÷³öÎÊÌâÁË£¿
¶þ ½â¾öÒýÈëÎÊÌâËùÐèµÄ֪ʶ
   Ö÷ÒªÐèÁ½·½ÃæµÄ֪ʶ£¬µÚÒ»¸öΪ×Ö·ûÓÈÆäÊǺº×ֵıàÂ룬ÒÔ¼°ÓïÑԺ͹¤¾ßµÄÖ§³ÖÇé¿ö£¬µÚ¶þ¸öÊÇvc/c++ÖÐMutiByte Charater Set ºÍ Wide Character SetÓйØÄÚ´æ·ÖÅäµÄÇé¿ö.
Èý ºº×ֵıàÂ뷽ʽ¼°ÔÚvc/c++ÖеĴ¦Àí
1.ºº×Ö±àÂ뷽ʽµÄ½éÉÜ
¶ÔÓ¢ÎÄ×Ö·ûµÄ´¦Àí£¬7λASCIIÂë×Ö·û¼¯ÖеÄ×Ö·û¼´¿ÉÂú×ãʹÓÃÐèÇó£¬ÇÒÓ¢ÎÄ×Ö·ûÔÚ¼ÆËã»úÉϵÄÊäÈë¼°Êä³öÒ²·Ç³£¼òµ¥£¬Òò´Ë£¬Ó¢ÎÄ×Ö·ûµÄÊäÈë¡¢´æ´¢¡¢ÄÚ²¿´¦ÀíºÍÊä³ö¶¼¿ÉÒÔÖ»ÓÃͬһ¸ö±àÂ루ÈçASCIIÂ룩¡£
¶øºº×ÖÊÇÒ»ÖÖÏóÐÎÎÄ×Ö£¬×ÖÊý¼«¶à£¨ÏÖ´úºº×ÖÖнö³£ÓÃ×Ö¾ÍÓÐÁù¡¢Æßǧ¸ö£¬×Ü×ÖÊý¸ß´ï5Íò¸öÒÔÉÏ£©£¬ÇÒ×ÖÐθ´ÔÓ£¬Ã¿Ò»¸ ......

C/C++ÖеÄÈÕÆÚºÍʱ¼ä

ͻ񻣼
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê׼ʱ¼ä£©£¬Calendar Time£¨ÈÕÀúʱ¼ä£©£¬epoch£¨Ê±¼äµã£©£¬clock tick£¨Ê±ÖÓ¼Æʱµ¥Ôª£©
1£®¸ÅÄî
ÔÚC/C++ÖУ¬¶Ô×Ö·û´®µÄ²Ù×÷ÓкܶàÖµµÃ×¢ÒâµÄÎÊÌ⣬ͬÑù£¬C/C++¶Ôʱ¼äµÄ²Ù×÷Ò²ÓÐÐí¶àÖµµÃ´ó¼Ò×¢ÒâµÄµØ·½¡£×î½ü£¬ÔÚ¼¼ÊõȺÖÐÓкܶàÍøÓÑÒ²¶à´ÎÎʵ½¹ýC++ÓïÑÔÖжÔʱ¼äµÄ²Ù×÷¡¢»ñÈ¡ºÍÏÔʾµÈµÈµÄÎÊÌâ¡£ÏÂÃ棬ÔÚÕâƪÎÄÕÂÖУ¬±ÊÕß½«Ö÷Òª½éÉÜÔÚC/C++ÖÐʱ¼äºÍÈÕÆÚµÄʹÓ÷½·¨.
ͨ¹ýѧϰÐí¶àC/C++¿â£¬Äã¿ÉÒÔÓкܶà²Ù×÷¡¢Ê¹ÓÃʱ¼äµÄ·½·¨¡£µ«ÔÚÕâ֮ǰÄãÐèÒªÁ˽âһЩ“ʱ¼ä”ºÍ“ÈÕÆÚ”µÄ¸ÅÄÖ÷ÒªÓÐÒÔϼ¸¸ö£º
Coordinated Universal Time£¨UTC£©£ºÐ­µ÷ÊÀ½çʱ£¬ÓÖ³ÆΪÊÀ½ç±ê׼ʱ¼ä£¬Ò²¾ÍÊÇ´ó¼ÒËùÊìÖªµÄ¸ñÁÖÍþÖαê׼ʱ¼ä£¨Greenwich Mean Time£¬GMT£©¡£±ÈÈ磬ÖйúÄڵصÄʱ¼äÓëUTCµÄʱ²îΪ+8£¬Ò²¾ÍÊÇUTC+8¡£ÃÀ¹úÊÇUTC-5¡£
Calendar Time£ºÈÕÀúʱ¼ä£¬ÊÇÓÓ´ÓÒ»¸ö±ê׼ʱ¼äµãµ½´ËʱµÄʱ¼ä¾­¹ýµÄà ......

C/C++ÖеÄÈÕÆÚºÍʱ¼ä

ͻ񻣼
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê׼ʱ¼ä£©£¬Calendar Time£¨ÈÕÀúʱ¼ä£©£¬epoch£¨Ê±¼äµã£©£¬clock tick£¨Ê±ÖÓ¼Æʱµ¥Ôª£©
1£®¸ÅÄî
ÔÚC/C++ÖУ¬¶Ô×Ö·û´®µÄ²Ù×÷ÓкܶàÖµµÃ×¢ÒâµÄÎÊÌ⣬ͬÑù£¬C/C++¶Ôʱ¼äµÄ²Ù×÷Ò²ÓÐÐí¶àÖµµÃ´ó¼Ò×¢ÒâµÄµØ·½¡£×î½ü£¬ÔÚ¼¼ÊõȺÖÐÓкܶàÍøÓÑÒ²¶à´ÎÎʵ½¹ýC++ÓïÑÔÖжÔʱ¼äµÄ²Ù×÷¡¢»ñÈ¡ºÍÏÔʾµÈµÈµÄÎÊÌâ¡£ÏÂÃ棬ÔÚÕâƪÎÄÕÂÖУ¬±ÊÕß½«Ö÷Òª½éÉÜÔÚC/C++ÖÐʱ¼äºÍÈÕÆÚµÄʹÓ÷½·¨.
ͨ¹ýѧϰÐí¶àC/C++¿â£¬Äã¿ÉÒÔÓкܶà²Ù×÷¡¢Ê¹ÓÃʱ¼äµÄ·½·¨¡£µ«ÔÚÕâ֮ǰÄãÐèÒªÁ˽âһЩ“ʱ¼ä”ºÍ“ÈÕÆÚ”µÄ¸ÅÄÖ÷ÒªÓÐÒÔϼ¸¸ö£º
Coordinated Universal Time£¨UTC£©£ºÐ­µ÷ÊÀ½çʱ£¬ÓÖ³ÆΪÊÀ½ç±ê׼ʱ¼ä£¬Ò²¾ÍÊÇ´ó¼ÒËùÊìÖªµÄ¸ñÁÖÍþÖαê׼ʱ¼ä£¨Greenwich Mean Time£¬GMT£©¡£±ÈÈ磬ÖйúÄڵصÄʱ¼äÓëUTCµÄʱ²îΪ+8£¬Ò²¾ÍÊÇUTC+8¡£ÃÀ¹úÊÇUTC-5¡£
Calendar Time£ºÈÕÀúʱ¼ä£¬ÊÇÓÓ´ÓÒ»¸ö±ê׼ʱ¼äµãµ½´ËʱµÄʱ¼ä¾­¹ýµÄà ......

ÈçºÎÔÚLinuxʹÓÃEclipse + CDT¿ª·¢C/C++³ÌÐò?

A. ΪʲôҪÔÚLinuxʹÓÃEclipse¿ª·¢C/C++³ÌÐò?
LinuxÊÇÒ»¸öÒÔC/C++¿ª·¢ÎªÖ÷µÄƽ̨£¬ÎÞÂÛÊÇKernel»òÊÇApplication£¬Ö÷Òª¶¼Ê¹ÓÃC/C++¿ª·¢¡£´«Í³ÔÚLinuxÏ¿ª·¢³ÌÐò£¬ÊÇÔÚÎÄ×ÖģʽÏ£¬ÀûÓÃviµÈÎÄ×ֱ༭Æ÷׫дC/C++³ÌÐò´æÅ̺ó£¬ÔÚCommand lineÏÂʹÓÃgcc±àÒ룬ÈôÒªdebug£¬ÔòʹÓÃgdb¡£
ÕâÖÖ¿ª·¢·½Ê½Éú²úÁ¦²¢²»¸ß£¬ÈôÖ»ÊÇ¿ª·¢Ñ§Ï°ÓõÄС³ÌÐòÔòÓ°Ïì²»´ó£¬µ«ÈôÒª¿ª·¢´óÐÍÏîĿʱ£¬³ÌÐòµµ°¸¸öÊýÖڶ࣬ÐèÒªÓÃproject»òsolutionµÄ·½Ê½¹ÜÀí£»ÇÒdebugʱbreakpointµÄ¼ÓÈ룬µ¥²½Ö´ÐУ¬¹Û²ì±äÁ¿±ä»¯µÈ£¬¶¼ÐèÒª¸ü¿ÉÊÓ»¯µÄ·½Ê½²ÅÄܹ»Ôö¼ÓÉú²úÁ¦£»×îÖØÒªµÄ£¬ÓÉÓÚÏÖÔڵijÌÐòÓïÑԽԷdz£µÄÅÓ´ó£¬ÓÖÓи´Ôӵĺ¯Ê½¿â£¬Òª³ÌÐòÔ±Êì¼ÇËùÓеijÌÐòÓï·¨ºÍfunctionÃû³Æ£¬ÊµÔÚºÜÀ§ÄÑ£¬ËùÒÔÓï·¨Ìáʾ(Intellisense)µÄ¹¦Äܾͷdz£ÖØÒª£¬ÕâЩ¾Í±ØÐë¿¿IDEÀ´´ï³É¡£
ÔÚWindowsƽ̨ÉÏ£¬ÈôÒª¿ª·¢C/C++³ÌÐò£¬ÎÒÃÇÓÐMicrosoft Visual Studio¡¢Borland C++ Builder¿ÉÓã¬ÕâЩ¶¼ÊǺܺÃÓõÄIDE£¬µ«¿Éϧ½öÄÜÔÚWindowsÏÂʹÓ㬵«ÊÇÔÚLinuxƽ̨ÄØ?»ùÓÚÒÔÏÂÀíÓÉ£¬ÎÒÍƼöʹÓÃEclipse¿ª·¢C/C++³ÌÐò£º
1. EclipseÊÇÒ»¸öÓÃJavaËù׫дIDE£¬Òò´Ë¿É¿çƽ̨£¬ËùÒÔÔÚLinuxºÍWindowsƽ̨ϽԿÉʹÓÃEclipse£¬¿É½µµÍ³ÌÐòÔ±ÊìÎöIDEµÄѧϰÇúÏß¡£ ......

ÈçºÎÔÚLinuxʹÓÃEclipse + CDT¿ª·¢C/C++³ÌÐò?

A. ΪʲôҪÔÚLinuxʹÓÃEclipse¿ª·¢C/C++³ÌÐò?
LinuxÊÇÒ»¸öÒÔC/C++¿ª·¢ÎªÖ÷µÄƽ̨£¬ÎÞÂÛÊÇKernel»òÊÇApplication£¬Ö÷Òª¶¼Ê¹ÓÃC/C++¿ª·¢¡£´«Í³ÔÚLinuxÏ¿ª·¢³ÌÐò£¬ÊÇÔÚÎÄ×ÖģʽÏ£¬ÀûÓÃviµÈÎÄ×ֱ༭Æ÷׫дC/C++³ÌÐò´æÅ̺ó£¬ÔÚCommand lineÏÂʹÓÃgcc±àÒ룬ÈôÒªdebug£¬ÔòʹÓÃgdb¡£
ÕâÖÖ¿ª·¢·½Ê½Éú²úÁ¦²¢²»¸ß£¬ÈôÖ»ÊÇ¿ª·¢Ñ§Ï°ÓõÄС³ÌÐòÔòÓ°Ïì²»´ó£¬µ«ÈôÒª¿ª·¢´óÐÍÏîĿʱ£¬³ÌÐòµµ°¸¸öÊýÖڶ࣬ÐèÒªÓÃproject»òsolutionµÄ·½Ê½¹ÜÀí£»ÇÒdebugʱbreakpointµÄ¼ÓÈ룬µ¥²½Ö´ÐУ¬¹Û²ì±äÁ¿±ä»¯µÈ£¬¶¼ÐèÒª¸ü¿ÉÊÓ»¯µÄ·½Ê½²ÅÄܹ»Ôö¼ÓÉú²úÁ¦£»×îÖØÒªµÄ£¬ÓÉÓÚÏÖÔڵijÌÐòÓïÑԽԷdz£µÄÅÓ´ó£¬ÓÖÓи´Ôӵĺ¯Ê½¿â£¬Òª³ÌÐòÔ±Êì¼ÇËùÓеijÌÐòÓï·¨ºÍfunctionÃû³Æ£¬ÊµÔÚºÜÀ§ÄÑ£¬ËùÒÔÓï·¨Ìáʾ(Intellisense)µÄ¹¦Äܾͷdz£ÖØÒª£¬ÕâЩ¾Í±ØÐë¿¿IDEÀ´´ï³É¡£
ÔÚWindowsƽ̨ÉÏ£¬ÈôÒª¿ª·¢C/C++³ÌÐò£¬ÎÒÃÇÓÐMicrosoft Visual Studio¡¢Borland C++ Builder¿ÉÓã¬ÕâЩ¶¼ÊǺܺÃÓõÄIDE£¬µ«¿Éϧ½öÄÜÔÚWindowsÏÂʹÓ㬵«ÊÇÔÚLinuxƽ̨ÄØ?»ùÓÚÒÔÏÂÀíÓÉ£¬ÎÒÍƼöʹÓÃEclipse¿ª·¢C/C++³ÌÐò£º
1. EclipseÊÇÒ»¸öÓÃJavaËù׫дIDE£¬Òò´Ë¿É¿çƽ̨£¬ËùÒÔÔÚLinuxºÍWindowsƽ̨ϽԿÉʹÓÃEclipse£¬¿É½µµÍ³ÌÐòÔ±ÊìÎöIDEµÄѧϰÇúÏß¡£ ......

ÈçºÎÔÚLinuxʹÓÃEclipse + CDT¿ª·¢C/C++³ÌÐò?

A. ΪʲôҪÔÚLinuxʹÓÃEclipse¿ª·¢C/C++³ÌÐò?
LinuxÊÇÒ»¸öÒÔC/C++¿ª·¢ÎªÖ÷µÄƽ̨£¬ÎÞÂÛÊÇKernel»òÊÇApplication£¬Ö÷Òª¶¼Ê¹ÓÃC/C++¿ª·¢¡£´«Í³ÔÚLinuxÏ¿ª·¢³ÌÐò£¬ÊÇÔÚÎÄ×ÖģʽÏ£¬ÀûÓÃviµÈÎÄ×ֱ༭Æ÷׫дC/C++³ÌÐò´æÅ̺ó£¬ÔÚCommand lineÏÂʹÓÃgcc±àÒ룬ÈôÒªdebug£¬ÔòʹÓÃgdb¡£
ÕâÖÖ¿ª·¢·½Ê½Éú²úÁ¦²¢²»¸ß£¬ÈôÖ»ÊÇ¿ª·¢Ñ§Ï°ÓõÄС³ÌÐòÔòÓ°Ïì²»´ó£¬µ«ÈôÒª¿ª·¢´óÐÍÏîĿʱ£¬³ÌÐòµµ°¸¸öÊýÖڶ࣬ÐèÒªÓÃproject»òsolutionµÄ·½Ê½¹ÜÀí£»ÇÒdebugʱbreakpointµÄ¼ÓÈ룬µ¥²½Ö´ÐУ¬¹Û²ì±äÁ¿±ä»¯µÈ£¬¶¼ÐèÒª¸ü¿ÉÊÓ»¯µÄ·½Ê½²ÅÄܹ»Ôö¼ÓÉú²úÁ¦£»×îÖØÒªµÄ£¬ÓÉÓÚÏÖÔڵijÌÐòÓïÑԽԷdz£µÄÅÓ´ó£¬ÓÖÓи´Ôӵĺ¯Ê½¿â£¬Òª³ÌÐòÔ±Êì¼ÇËùÓеijÌÐòÓï·¨ºÍfunctionÃû³Æ£¬ÊµÔÚºÜÀ§ÄÑ£¬ËùÒÔÓï·¨Ìáʾ(Intellisense)µÄ¹¦Äܾͷdz£ÖØÒª£¬ÕâЩ¾Í±ØÐë¿¿IDEÀ´´ï³É¡£
ÔÚWindowsƽ̨ÉÏ£¬ÈôÒª¿ª·¢C/C++³ÌÐò£¬ÎÒÃÇÓÐMicrosoft Visual Studio¡¢Borland C++ Builder¿ÉÓã¬ÕâЩ¶¼ÊǺܺÃÓõÄIDE£¬µ«¿Éϧ½öÄÜÔÚWindowsÏÂʹÓ㬵«ÊÇÔÚLinuxƽ̨ÄØ?»ùÓÚÒÔÏÂÀíÓÉ£¬ÎÒÍƼöʹÓÃEclipse¿ª·¢C/C++³ÌÐò£º
1. EclipseÊÇÒ»¸öÓÃJavaËù׫дIDE£¬Òò´Ë¿É¿çƽ̨£¬ËùÒÔÔÚLinuxºÍWindowsƽ̨ϽԿÉʹÓÃEclipse£¬¿É½µµÍ³ÌÐòÔ±ÊìÎöIDEµÄѧϰÇúÏß¡£ ......

ÉîÈëC/C++Ö®»ùÓÚCheckStackVarsµÄ°²È«¼ì²é£¨VS2008£©

×î½üһֱæ±ÏÒµµÄÏà¹ØÊÂÇ飬¼ÓÉϹ¤×÷£¬×ªÑۼ䣬ÓÖµ½Ôµ×ÁË£¬Ö®Ç°³ÐŵµÄÿÔÂһƪ²©ÎÄ£¬Ç°¼¸Ìì¾ÍÒ»Ö±ÔÚÑ°ÕÒµ½µ×Ҫдʲô£¬½üÁ½ÌìÓÖͻȻ·¢ÏÖÓкܶණÎ÷¿ÉÒÔд¡£±¾Æª¾ÍÏÈÑÓÐø֮ǰµÄһƪ»ùÓÚCookieµÄ°²È«¼ì²é»úÖÆ£¨ÉîÈëC/C++Ö®»ùÓÚCookieµÄ°²È«¼ì²é£¨VS2005£©£©À´½éÉÜÏÂÁíÍâÒ»ÖÖÔÚDEBUG°æ±¾Ïµİ²È«¼ì²é£¬Ò²¾ÍÊÇCheckStackVars¼ì²é£¬»°²»¶à˵£¬Ö±½Ó½øÈëÕýÌâ¡£
ÔÚVS2008Ï£¬º¯ÊýµÄÕ»¿Õ¼äÀïÈç¹û´æÔÚÊý×飬¾Í»á×Ô¶¯¼ÓÉÏCheckStackVars¼ì²é£¬¹ËÃû˼Ò壬¾ÍÊÇÓÃÀ´¼ì²é¾Ö²¿Êý¾ÝÊÇ·ñ·ÃÎÊÔ½½ç¡£Ïà¶ÔÀ´Ëµ£¬ÕâÖÖ¼ì²éÖ»ÄÜÆðµ½Ò»¶¨µÄ×÷Ó㬲¢²»»áËùÓÐÔ½½ç·ÃÎʶ¼Äܼì²éµ½£¬¸ù¾ÝºóÃæµÄÔ­Àí½éÉÜ»áÁ˽⵽Õâµã¡£¼ÈÈ»ÊǼì²é¾Ö²¿µÄ£¬ÄÇôÔÚº¯ÊýÄÚ¶¨ÒåµÄstaticÀàÐÍÊý×é»òÕߺ¯ÊýÍⲿµÄÈ«¾ÖÊý×é²¢²»»á²ÉÓô˼ì²é£¬¼ÈÈ»ÊǼì²éÊý×飬ÄÇôÈç¹ûº¯ÊýÄÚûÓоֲ¿Êý×éʱ£¬´Ë¼ì²éÒ²²»»á´æÔÚ¡£
Ê×ÏÈÀ´¿´Ò»¸ö¼òµ¥µÄÀý×Ó£¬ÑéÖ¤Õâ¸ö¼ì²éµÄ´æÔÚ£º
void TestVars( void )
{
    int bf = 0xeeeeeeee;
    char array[10] = { 0 };
    int bk = 0xffffffff;
   
    strcpy( array, "masefee" );
}
int main( void )
{
 & ......

ÉîÈëC/C++Ö®»ùÓÚCheckStackVarsµÄ°²È«¼ì²é£¨VS2008£©

×î½üһֱæ±ÏÒµµÄÏà¹ØÊÂÇ飬¼ÓÉϹ¤×÷£¬×ªÑۼ䣬ÓÖµ½Ôµ×ÁË£¬Ö®Ç°³ÐŵµÄÿÔÂһƪ²©ÎÄ£¬Ç°¼¸Ìì¾ÍÒ»Ö±ÔÚÑ°ÕÒµ½µ×Ҫдʲô£¬½üÁ½ÌìÓÖͻȻ·¢ÏÖÓкܶණÎ÷¿ÉÒÔд¡£±¾Æª¾ÍÏÈÑÓÐø֮ǰµÄһƪ»ùÓÚCookieµÄ°²È«¼ì²é»úÖÆ£¨ÉîÈëC/C++Ö®»ùÓÚCookieµÄ°²È«¼ì²é£¨VS2005£©£©À´½éÉÜÏÂÁíÍâÒ»ÖÖÔÚDEBUG°æ±¾Ïµİ²È«¼ì²é£¬Ò²¾ÍÊÇCheckStackVars¼ì²é£¬»°²»¶à˵£¬Ö±½Ó½øÈëÕýÌâ¡£
ÔÚVS2008Ï£¬º¯ÊýµÄÕ»¿Õ¼äÀïÈç¹û´æÔÚÊý×飬¾Í»á×Ô¶¯¼ÓÉÏCheckStackVars¼ì²é£¬¹ËÃû˼Ò壬¾ÍÊÇÓÃÀ´¼ì²é¾Ö²¿Êý¾ÝÊÇ·ñ·ÃÎÊÔ½½ç¡£Ïà¶ÔÀ´Ëµ£¬ÕâÖÖ¼ì²éÖ»ÄÜÆðµ½Ò»¶¨µÄ×÷Ó㬲¢²»»áËùÓÐÔ½½ç·ÃÎʶ¼Äܼì²éµ½£¬¸ù¾ÝºóÃæµÄÔ­Àí½éÉÜ»áÁ˽⵽Õâµã¡£¼ÈÈ»ÊǼì²é¾Ö²¿µÄ£¬ÄÇôÔÚº¯ÊýÄÚ¶¨ÒåµÄstaticÀàÐÍÊý×é»òÕߺ¯ÊýÍⲿµÄÈ«¾ÖÊý×é²¢²»»á²ÉÓô˼ì²é£¬¼ÈÈ»ÊǼì²éÊý×飬ÄÇôÈç¹ûº¯ÊýÄÚûÓоֲ¿Êý×éʱ£¬´Ë¼ì²éÒ²²»»á´æÔÚ¡£
Ê×ÏÈÀ´¿´Ò»¸ö¼òµ¥µÄÀý×Ó£¬ÑéÖ¤Õâ¸ö¼ì²éµÄ´æÔÚ£º
void TestVars( void )
{
    int bf = 0xeeeeeeee;
    char array[10] = { 0 };
    int bk = 0xffffffff;
   
    strcpy( array, "masefee" );
}
int main( void )
{
 & ......

CºÍC++ÖеÄÖ÷ÒªÊý¾ÝÀàÐͺÍ×Ö½Ú´óС

CºÍC++ÖеÄÖ÷ÒªÊý¾ÝÀàÐͺÍ×Ö½Ú´óС(
    C/C++µÄд·¨ÊDz»¿ÆѧºÍ²»ÑϽ÷µÄ¡£ÒòΪCºÍC++ËäÈ»ÓïÒ壬µ«ÊÇÉè¼Æ˼ÏëÊǽṹ»¯ÓëÃæÏò¶ÔÏó. C±ê×¼¹æ·¶ÓëC++µÄ±ê×¼¹æ·¶Ò²ÊÇÁ½¸öÎı¾¡£½üÀ´×ÐϸÑо¿ÁËËüÃǵÄÊý¾ÝÀàÐÍ£¬²ÅÖªµÀÆäÀ´ÁúÈ¥Âö£¬ÕæÕý×öµ½ÆäʵËùÒÔÈ»¡£
1¡¢CÓïÑÔ¶¨ÒåÁË5ÖÖ»ù±¾Êý¾ÝÀàÐÍ
  char(×Ö·û), int(ÕûÊý), float(µ¥¾«¶È), double(Ë«¾«¶È),void;
ÔÚ32λ»úÆ÷ÉÏ,sizeofµÄÆäÖµ·Ö±ðΪ£º
  sizeof(char)=1, sizeof(int)=4, sizeof(float)=4, sizeof(double)=8;
 sizeof(char*)=4;(ÈκÎÀàÐÍÖ¸Õë±äÁ¿Îª32λ¼´4¸ö×Ö½Ú)
2¡¢C++ÓïÑÔÓÚC»ù´¡ÉÏÔö¼Ó2ÖÖÊý¾ÝÀàÐÍ£º
 bool(²¼¶û),wchar_t(¿í×Ö·û);
ÔÚ32λ»úÆ÷ÉÏ,sizeofµÄÆäÖµ·Ö±ðΪ:
 sizeof(bool)=1, sizeof(wchar_t)=2, sizeof(bool*)=sizeof(wchar_t*)=4;
3¡¢Êý¾ÝÀàÐ͵Ļù±¾ÐÞÊηû:
  signed(ÓзûºÅ), unsigned(ÎÞ·ûºÅ),long(³¤Õû),short(¶ÌÕû)
4¡¢²âÊÔ´úÂë:
 size_t nchar=sizeof(char);
 size_t nfloat=sizeof(float);
 size_t ndouble=sizeof(double);
 size_t nint = sizeof(int);
 a.Format("CÓïÑÔÊý¾ÝÀàÐͳ¤¶È:char=%d,float=%d,double ......

CºÍC++ÖеÄÖ÷ÒªÊý¾ÝÀàÐͺÍ×Ö½Ú´óС

CºÍC++ÖеÄÖ÷ÒªÊý¾ÝÀàÐͺÍ×Ö½Ú´óС(
    C/C++µÄд·¨ÊDz»¿ÆѧºÍ²»ÑϽ÷µÄ¡£ÒòΪCºÍC++ËäÈ»ÓïÒ壬µ«ÊÇÉè¼Æ˼ÏëÊǽṹ»¯ÓëÃæÏò¶ÔÏó. C±ê×¼¹æ·¶ÓëC++µÄ±ê×¼¹æ·¶Ò²ÊÇÁ½¸öÎı¾¡£½üÀ´×ÐϸÑо¿ÁËËüÃǵÄÊý¾ÝÀàÐÍ£¬²ÅÖªµÀÆäÀ´ÁúÈ¥Âö£¬ÕæÕý×öµ½ÆäʵËùÒÔÈ»¡£
1¡¢CÓïÑÔ¶¨ÒåÁË5ÖÖ»ù±¾Êý¾ÝÀàÐÍ
  char(×Ö·û), int(ÕûÊý), float(µ¥¾«¶È), double(Ë«¾«¶È),void;
ÔÚ32λ»úÆ÷ÉÏ,sizeofµÄÆäÖµ·Ö±ðΪ£º
  sizeof(char)=1, sizeof(int)=4, sizeof(float)=4, sizeof(double)=8;
 sizeof(char*)=4;(ÈκÎÀàÐÍÖ¸Õë±äÁ¿Îª32λ¼´4¸ö×Ö½Ú)
2¡¢C++ÓïÑÔÓÚC»ù´¡ÉÏÔö¼Ó2ÖÖÊý¾ÝÀàÐÍ£º
 bool(²¼¶û),wchar_t(¿í×Ö·û);
ÔÚ32λ»úÆ÷ÉÏ,sizeofµÄÆäÖµ·Ö±ðΪ:
 sizeof(bool)=1, sizeof(wchar_t)=2, sizeof(bool*)=sizeof(wchar_t*)=4;
3¡¢Êý¾ÝÀàÐ͵Ļù±¾ÐÞÊηû:
  signed(ÓзûºÅ), unsigned(ÎÞ·ûºÅ),long(³¤Õû),short(¶ÌÕû)
4¡¢²âÊÔ´úÂë:
 size_t nchar=sizeof(char);
 size_t nfloat=sizeof(float);
 size_t ndouble=sizeof(double);
 size_t nint = sizeof(int);
 a.Format("CÓïÑÔÊý¾ÝÀàÐͳ¤¶È:char=%d,float=%d,double ......

Beautify your c/c++ source code

http://uncrustify.sourceforge.net/
Ident code, aligning on parens, assignments, etc
Align on '=' and variable definitions
Align structure initializers
Align #define stuff
Align backslash-newline stuff
Reformat comments (a little bit)
Fix inter-character spacing
Add or remove parens on return statements
Add or remove braces on single-statement if/do/while/for statements
Supports embedded SQL 'EXEC SQL' stuff
Highly configurable - 385 configurable options as of version 0.56
Output :
const char *token_names[] =
{
[CT_POUND] = "POUND",
[CT_PREPROC] = "PREPROC",
[CT_PREPROC_BODY] = "PREPROC_BODY",
[CT_PP] = "PP",
};
int main(int argc, char *argv[])
{
struct junk a[] =
{
{ "version", 0, 0, 0 },
{ "file", 1, 150, 'f' },
{ "config", 1, 0, 'c' },
{ "parsed", 25, 0, 'p' },
{ NULL, 0, 0, 0 }
};
}
color_t colors[] =
{
{ "red", { 255, 0, 0 } }, { "blue", { 0 ......

Beautify your c/c++ source code

http://uncrustify.sourceforge.net/
Ident code, aligning on parens, assignments, etc
Align on '=' and variable definitions
Align structure initializers
Align #define stuff
Align backslash-newline stuff
Reformat comments (a little bit)
Fix inter-character spacing
Add or remove parens on return statements
Add or remove braces on single-statement if/do/while/for statements
Supports embedded SQL 'EXEC SQL' stuff
Highly configurable - 385 configurable options as of version 0.56
Output :
const char *token_names[] =
{
[CT_POUND] = "POUND",
[CT_PREPROC] = "PREPROC",
[CT_PREPROC_BODY] = "PREPROC_BODY",
[CT_PP] = "PP",
};
int main(int argc, char *argv[])
{
struct junk a[] =
{
{ "version", 0, 0, 0 },
{ "file", 1, 150, 'f' },
{ "config", 1, 0, 'c' },
{ "parsed", 25, 0, 'p' },
{ NULL, 0, 0, 0 }
};
}
color_t colors[] =
{
{ "red", { 255, 0, 0 } }, { "blue", { 0 ......
×ܼǼÊý:969; ×ÜÒ³Êý:162; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [1] [2] [3] 4 [5] [6] [7] [8] [9] [10]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ