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

[ת]C/C++µÄ64λÕûÐÍ

Technorati ±êÇ©: C++ Ô­ÎĵØÖ·£ºhttp://www.byvoid.com/blog/c-int64/ ÔÚC/C++ÖУ¬64ΪÕûÐÍÒ»Ö±ÊÇÒ»ÖÖûÓÐÈ·¶¨¹æ·¶µÄÊý¾ÝÀàÐÍ¡£ÏÖ½ñÖ÷Á÷µÄ±àÒëÆ÷ÖУ¬¶Ô64ΪÕûÐ͵ÄÖ§³ÖÒ²ÊDZê×¼²»Ò»£¬ÐÎ̬¸÷Òì¡£Ò»°ãÀ´Ëµ£¬64λÕûÐ͵Ķ¨Ò巽ʽÓÐlong longºÍ__int64Á½ÖÖ(VC»¹Ö§³Ö_int64)£¬¶øÊä³öµ½±ê×¼Êä³ö·½Ê½ÓÐprintf(¡°%lld¡±,a)£¬printf(¡°%I64d¡±,a)£¬ºÍcout << aÈýÖÖ·½Ê½¡£ ±¾ÎÄÌÖÂÛµÄÊÇÎåÖÖ³£ÓõÄC/C++±àÒëÆ÷¶Ô64λÕûÐ͵ÄÖ§³Ö£¬ÕâÎåÖÖ±àÒëÆ÷·Ö±ðÊÇgcc(mingw32)£¬g++(mingw32)£¬gcc(linux i386)£¬g++(linux i386)£¬Microsoft Visual C++ 6.0¡£¿ÉϧµÄÊÇ£¬Ã»ÓÐÒ»ÖÖ¶¨ÒåºÍÊä³ö·½Ê½×éºÏ£¬Í¬Ê±¼æÈÝÕâÎåÖÖ±àÒëÆ÷¡£Îª³¹µ×ŪÇ岻ͬ±àÒëÆ÷¶Ô64λÕûÐÍ£¬ÎÒдÁ˳ÌÐò¶ÔËüÃǽøÐÐÁËÆÀ²â£¬½á¹ûÈçÏÂ±í¡£ ±äÁ¿¶¨Òå Êä³ö·½Ê½ gcc(mingw32) g++(mingw32) gcc(linux i386) g++(linux i386) MicrosoftVisual C++ 6.0 long long ¡°%lld¡± ´íÎó ´íÎó ÕýÈ· ÕýÈ· ÎÞ·¨±àÒë long long ¡°%I64d¡± ÕýÈ· ÕýÈ· ´íÎó ´íÎó ÎÞ·¨±àÒë __int64 ¡°lld¡± ´íÎó ´íÎó ÎÞ·¨±àÒë ÎÞ·¨±àÒë ´íÎó __int64 ¡°%I64d¡± ÕýÈ· ÕýÈ· ÎÞ·¨±àÒë ÎÞ·¨±àÒë ÕýÈ· long long cout ·ÇC++ ÕýÈ· ·ÇC++ ÕýÈ· ÎÞ·¨±àÒë __int64 cout ·ÇC++ ÕýÈ· ·ÇC++ ÎÞ·¨±àÒë ÎÞ·¨±àÒë long long printint64() ÕýÈ· ÕýÈ· ÕýÈ· ÕýÈ· ÎÞ·¨±àÒë
ÉϱíÖУ¬ÕýÈ·Ö¸±àÒëͨ¹ý£¬ÔËÐÐÍêÈ«ÕýÈ·£»´íÎóÖ¸±àÒëËäȻͨ¹ý£¬µ«ÔËÐнá¹ûÓÐÎó£»ÎÞ·¨±àÒëÖ¸±àÒëÆ÷¸ù±¾²»ÄܱàÒëÍê³É¡£¹Û²ìÉÏ±í£¬ÎÒÃÇ¿ÉÒÔ·¢ÏÖÒÔϼ¸µã£º long long¶¨Ò巽ʽ¿ÉÒÔÓÃÓÚgcc/g++£¬²»ÊÜƽ̨ÏÞÖÆ£¬µ«²»ÄÜÓÃÓÚVC6.0¡£ __int64ÊÇWin32ƽ̨±àÒëÆ÷64볤ÕûÐ͵Ķ¨Ò巽ʽ£¬²»ÄÜÓÃÓÚLinux¡£ ¡°%lld¡±ÓÃÓÚLinux i386ƽ̨±àÒëÆ÷£¬¡±%I64d¡±ÓÃÓÚWin32ƽ̨±àÒëÆ÷¡£ coutÖ»ÄÜÓÃÓÚC++±àÒ룬ÔÚVC6.0ÖУ¬cout²»Ö§³Ö64볤ÕûÐÍ¡£ ±íÖÐ×îºóÒ»ÐÐÊä³ö·½Ê½ÖеÄprinti


Ïà¹ØÎĵµ£º

cºÍjavaÖеĶþ½øÖÆÎļþ


×î½üÐèҪдһ¶Î³ÌÐò£¬Íê³ÉÒÔÏµĹ¤×÷£¬ÓÃjava½«Êý¾ÝÒÔ¶þ½øÖƵÄÐÎʽдÈëÎļþÖУ¬È»ºóÓÃC¶Á³ö´Ë¶þ½øÖÆÎļþ¡£
¿ªÊ¼µÄʱºòûÓп¼ÂÇ»úÆ÷µÄ×Ö½ÚÐò£¬Ö±½Ó¸ã³ösegment fault.ÏëÁ˺ܾ㬲ÅÃ÷°×Ô­À´ÊÇjavaºÍCµÄ×Ö½ÚÐòÊDz»Ò»ÑùµÄ¡£
javaÖеÄ×Ö½ÚÐòÊÇbig endianµÄ£¬ËüÊÇÓë»úÆ÷Î޹صġ£¶øcµÄ×Ö»úÐòÊÇ»úÆ÷Ïà¹ØµÄ£¬¶øµ±Ç°ÓõĻúÆ÷ÊÇx84 ......

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 ......

C±à³Ì¾«´â

¹æÔò»ò½¨Ò顣ÿÌõ×¼Ôò¶¼ÓÐÀýÍâ
1£¬¼ÙÏëµÄ±àÒë³ÌÐò
ʹÓñàÒë³ÌÐòËùÓеĿÉÑ¡¾¯¸æÉèÊ©
ʹÓÃlintÀ´²é³ö±àÒë³ÌÐò©µôµÄ´íÎó
Èç¹ûÓе¥Ôª²âÊÔ£¬¾Í½øÐе¥Ôª²âÊÔ
2£¬×Ô¼ºÉè¼Æ²¢Ê¹ÓöÏÑÔ
¼ÈҪά»¤³ÌÐòµÄ½»¸¶°æ±¾£¬ÓÖҪά»¤³ÌÐòµÄµ÷ÊÔ°æ±¾
ҪʹÓöÏÑÔ¶Ôº¯Êý²ÎÊý½øÐÐÈ·ÈÏ
Òª´Ó³ÌÐòÖÐɾȥÎÞ¶¨ÒåµÄÌØÐÔ£¬»òÕßÔÚ³ÌÐòÖÐʹÓöÏÑÔÀ´¼ ......

C/C++º¯Êý²ÎÊý,´«ÖµÓò´«Ö·µÄÇø±ð!!!

/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010Äê5ÔÂ8ÈÕ, ÏÂÎç2:47
*/
#include <iostream>
using namespace std;
class A{
public:
A(){
cout << "Ö´Ðй¹Ô캯Êý´´½¨Ò»¸ö¶ÔÏó" << endl;
}
A(A&){
cout << "Ö´Ðп½±´º¯Êý¿½±´Ò»¸ö¶ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ