C/C++ÖÐÖ¸Õë¼Ó 1 µÄÎÊÌâ
ÏÈÓñ´¶ûµÄÒ»µÀ±ÊÊÔÌâ¼òÒªµÄ˵Ã÷һϰɣº
¡¾Ì⡿˵Ã÷ÒÔϳÌÐò¡£
#include
int main(void)
{
unsigned int a[3] = {0x01020304, 0x05060708, 0x090a0b0c};
unsigned int *p = (unsigned int *)((int)a +1);¢Ù
printf("%x\n", *p);
return 0;
}
¡¾ÌâÄ¿½âÎö¡¿
Õâ¶Î³ÌÐòµÄÊä³ö½á¹ûÓ¦¸ÃÊÇ 8010203£¨¼´0x08010203£©¡£
ÄÚ´æ´æ´¢½á¹¹È磨ͼ1£©Ëùʾ£¨ÔÚ big-endian µÄϵͳÖУ©¡£ÔÚ¢Ù´¦µÄÓï¾äÖУ¬Ê×ÏÈ°ÑÊý×é a µÄÊ×µØַת»¯ÎªÕûÐÍ£¬È»ºóÔÙ¼Ó 1 £¬ÔÙÇ¿ÖÆת»¯Îª (unsigned int *) ,Õâ¸öʱºò p ÖµÓ¦¸ÃÊÇ 0x1235£¬ËùÒÔÈ¡µÄÊÇ´Ó 0x1235 µ½ 0x1238 Ëĸö×Ö½Ú×é³ÉµÄеÄÕûÊý£¬ËùÒÔ¾ÍÊÇ 0x08010203¡£
¸ø³ö¹«Ê½µÄ»°¾ÍÊÇ (a[0]>>8 | a[1]
Ïà¹ØÎĵµ£º
ÍøÓѹ۵ã:
(Ò»):
ÎÒÈÏΪºÜ¶àÈËûÓÐÀí½âlinus»òÕßmyanµÄÒâ˼£¬ÎÒ¾Ù¸öʵÀý¡£
ÎÒÃÇÏÖÔÚÒªÉè¼ÆÒ»Ì×ÍøÂ磿ͻ§¶ËÈí¼þ£¬ÎÒÃÇÒªÏÈ°ÑÐÒ鶨ºÃ£¬°Ñ½çÃæºÍºǫ́½»»¥Éè¼ÆÏëºÃ£¬°ÑÈÝ´íºÍ»Ö¸´ÏëºÃ£¬ÎÒÈÏΪÕâЩÊÇ×îÖØÒªµÄ£¬ÖÁÓÚ±àÂ룬ÓÃCÒ²¿ÉÒÔ±à³öÀ´£¬ÓÃC£«£«Ò²¿ÉÒÔ±à³öÀ´£¬ÉõÖÁÓÃJAVAÒ²Äܱà³öÀ´£¬¹Ø¼üÊÇÕû¸öÈí¼þµÄ¼Ü¹¹ÒªÇåÎú£¬Õ ......
ÒÔÏÂÊÇÎҵIJâÊÔociµÄÀý×Ó£¡
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "oci.h"
static OCIServer *srvhp;
static OCISession *p_session;
static OCIEnv &nb ......
C/C++ÊDz»¼ì²éÊý×éϱêÊÇ·ñÔ½½çµÄ¡£
²»¼ì²éϱêÊÇ·ñÔ½½ç¿ÉÒÔÓÐЧÌá¸ß³ÌÐòÔËÐеÄЧÂÊ£¬ÒòΪÈç¹ûÄã¼ì²é£¬ÄÇô±àÒëÆ÷±ØÐëÔÚÉú³ÉµÄÄ¿±ê´úÂëÖмÓÈë¶îÍâµÄ´úÂëÓÃÓÚ³ÌÐòÔËÐÐʱ¼ì²âϱêÊÇ·ñÔ½½ç£¬Õâ¾Í»áµ¼Ö³ÌÐòµÄÔËÐÐËÙ¶ÈϽµ£¬ËùÒÔΪÁ˳ÌÐòµÄÔËÐÐЧÂÊ£¬C/C++²Å²»¼ì²éϱêÊÇ·ñÔ½½ç¡£
  ......
1.ÒýÑÔ
¡¡¡¡C++ÓïÑԵĴ´½¨³õÖÔÊÇ¡°a better C¡±£¬µ«ÊÇÕâ²¢²»Òâζ×ÅC++ÖÐÀàËÆCÓïÑÔµÄÈ«¾Ö±äÁ¿ºÍº¯ÊýËù²ÉÓõıàÒëºÍÁ¬½Ó·½Ê½ÓëCÓïÑÔÍêÈ«Ïàͬ¡£×÷ΪһÖÖÓûÓëC¼æÈݵÄÓïÑÔ£¬C++±£ÁôÁËÒ»²¿·Ö¹ý³ÌʽÓïÑÔµÄÌص㣨±»ÊÀÈ˳ÆΪ¡°²»³¹µ×µØÃæÏò¶ÔÏó¡±£©£¬Òò¶øËü¿ÉÒÔ¶¨Òå²»ÊôÓÚÈκÎÀàµÄÈ«¾Ö±äÁ¿ºÍº¯Êý¡£µ«ÊÇ£¬C++±Ï¾¹ÊÇÒ»ÖÖÃæÏò¶ ......