¹ØÓÚC/C++µÄλÓò
ÔÚC/C++ÖÐÎÒÃÇÓÐʱΪÁ˽ÚÊ¡ÄÚ´æÕ¼Óÿռ䣬ÐèҪʹÓõ½Î»Óò£¬ÈçÏÂËùʾ´úÂ룺
struct SDummy
{
int A : 2;
int B : 8;
int C : 12;
int D : 10;
};
ÔÚ¼ÆËã»úÄÚ´æ°º¹óµÄÇé¿öÏ£¬Î»Óò²»·¦ÎªÒ»ÖÖÓÐЧµÄ½ÚÊ¡ÄÚ´æÕ¼ÓÿռäÓÖÈôúÂëÊéд±È½ÏͨË×Ò׶®µÄ·½·¨¡£µ«ÊÇÔÚÏÖ½ñÄÚ´æÏà¶Ô±ãÒ˵Äʱ´ú£¬Ó¦ÓÃÈí¼þÖÐËƺõÒѾºÜÉÙ¼ûµ½Î»ÓòµÄʹÓÃÁË¡£Î»ÓòµÄʹÓã¬ÔÚѧϰCÓïÑÔµÄʱºòÓÐѧϰ¹ý£¬µ«ÊÇÔÚʵ¼ÊÏîÄ¿ÖкÜÉÙÓõ½£¬Ò²Ã»ÓÐ×ÐϸȥÑо¿Ëü£¬Ö±µ½ÉÏÖÜÎÒΪÁËÈÃÒ»¸ö64λµÄ±äÁ¿±íʾÎÒËùÐèÒªµÄ¼¸¸öÐÅϢʱ£¬²Å½«Ëü×ÐϸȥÑо¿ÁËÒ»·¬¡£
ÎÒÔÚ×î½üµÄÏîÄ¿ÖУ¬ÐèÒªÒ»¸ö±äÁ¿£¬Í¨¹ýÕâ¸ö±äÁ¿ÄÜÖªµÀÆä±íʾµÄÄêÔÂÈÕʱ·ÖÃëµÈÐÅÏ¢¡£ÓÉÓÚÎÒÏëʹÄê¿É±íʾ20Äê¼´¿É£¬¹ÊÐèÒª5λÀ´±íʾ£»Ô¹²12Ô£¬ÐèÒª4λ£»ÈÕ¹²31ÈÕ£¬ÐèÒª5λ£»Ê±¹²24Сʱ£¬ÐèÒª5λ£»·Ö60·Ö£¬ÐèÒª6λ£»Ãë60Ã룬ÐèÒª6λ£»µ±È»»¹ÓÐÆäËüÐÅÏ¢£¬ÎÒÒ²¸ù¾ÝÐèÒª·ÖÅäÁËÏàӦλµÄλÓò¡£ÓÚÊÇÎÒд³öÁËÈçÏÂËùʾ´úÂ룺
struct SDummy
{
U8 Year : 5;
U8 Month : 4;
U8 Day : 5;
U8 Hour : 5;
U8 Minute :6;
U8 Second : 6;
U16 ID1;
U16 ID2;
U16 ID3;
U16 ID4;
};
Õâ¸ö½á¹¹ÖеÄU8¾ÍÊÇunsigned char£¬U16¾ÍÊÇunsigned short¡£µ«ÊdzÌÐòµÄÔËÐнá¹û²¢²»ÊÇ°´ÕÕÎÒµÄÏë·¨ËùµÃµÄ½á¹û¡£Õâ¸ö½á¹¹²¢²»ÊÇÎÒÏëÒªµÄÓÃ64λ¾Í¿ÉÒÔ±íʾ£¬¶øÊdz¬¹ýÁË64λËùÓÃ8×Ö½Ú£¡Î´Í꣬´ýÐø£¡
Ïà¹ØÎĵµ£º
²ÉÓÃ×¢Èëµ½ÆäËû½ø³ÌµÄ·½·¨À´Òþ²Ø×Ô¼ºµÄ½ø³Ì¡£¾ÍÊÇ˵£¬°ÑÄãÏë×öµÄÊÂÇé¼ÄÉúµ½±ðÈ˵Ľø³ÌÀïÃæ¡£±ÈÈçIEʲôµÄ¡£¹ØÓÚ×¢ÈëµÄ·½·¨ºÜ¶à£¬ÏÂÃæÎÒ¸øÄãÒ»¸öDLL×¢ÈëµÄ·½·¨£¬Õâ¸öÊÇÎÒ×öijÍâ¹ÒʱÓùýµÄ´úÂ룬Äã²Î¿¼Ò»Ï°ѡ£
int APIENTRY _tWinMain( HINSTANCE hInstance,
  ......
LinuxÏÂCºÍC++¿ª·¢»ù´¡
»ù±¾±à³Ì¸ÅÄî
n ±à³ÌÓïÑÔ£ºC ¡¢C++
n ±àÒë(compile)£ºÔ´Îļþ£¨.c£©->Ä¿±êÎļþ(.o)
n Á¬½Ó(link)£ºÄ¿±êÎļþ(.o)->¿ÉÖ´ÐÐÎļþ
n ¿â(library)£º¾²Ì¬Á¬½Ó¿â(.a)¡¢¶¯Ì¬Á¬½Ó¿â(.so)
LinuxÏ¿ª·¢¹¤¾ß
n±à¼Æ÷£ºvi¡¢emacs¡¢´°¿Ú±à¼Æ÷
n±àÒëÆ÷£ºGCC
nµ÷ÊÔÆ÷£ºGDB
n¿ÉÖ´ÐÐÎļþ¹¤¾ß£ ......
http://www.cppreference.com/wiki/cn/stl/algorithm/remove
Óï·¨:
#include <algorithm>
forward_iterator remove( forward_iterator start, forward_iterator end, const TYPE& val );
remove Ëã·¨ÒƳý [start,end) ·¶Î§Ö®ÄÚµÄËùÓÐÓë val ÏàµÈµÄÔªËØ¡£
´Ëº¯ÊýµÄ·µ»ØÖµÊÇÒ»¸öµ ......
1.
ÒýÑÔ
¡¡¡¡C++
ÓïÑԵĴ´½¨³õÖÔÊÇ“a
better C”
£¬µ«ÊÇÕâ²¢²»Òâζ×ÅC++
ÖÐÀàËÆC
ÓïÑÔµÄÈ«¾Ö±äÁ¿ºÍº¯ÊýËù²ÉÓõıàÒëºÍÁ¬½Ó·½Ê½ÓëC
ÓïÑÔÍêÈ«Ïàͬ¡£×÷ΪһÖÖÓûÓëC
¼æÈݵÄÓïÑÔ£¬C++
±£ÁôÁËÒ»²¿·Ö¹ý³Ì ʽÓïÑÔµÄÌص㣨±»ÊÀÈ˳ÆΪ“
²»³¹µ×µØÃæÏò¶ÔÏó”
£©£¬Òò¶øËü¿ÉÒÔ¶¨Òå²»ÊôÓÚÈκÎÀàµÄÈ«¾Ö ......
#include "mex.h"
#define DWORD long
#define NUMBER_OF_STRUCTS (sizeof(friends)/sizeof(struct phonebook))
#define NUMBER_OF_FIELDS (sizeof(field_names)/sizeof(*field_names))
void mexFunction(int nlhs,
mxArray * plhs[] , int nrhs,const mxArray * pahs[])
{
typedef struc ......