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

¡¾×ª¡¿CµÄÁíÒ»ÖØÒªÊý¾Ý½á¹¹bit fields

½ñÌì¿´K&RµÄÊéµÄʱºò˳±ãÎÂÏ°ÁËCµÄÁíÒ»ÖØÒªÊý¾Ý½á¹¹bit-fields£¬ÎÒÏëbit-fieldsÔÚ±àдµ×²ãÇý¶¯
Çý¶¯³ÌÐòµÄʱºòÓ¦¸Ã±È½ÏºÃÓã¬Ëü¿ÉÒÔÈÆ¿ª"&"ºÍ"|"½øÐÐλ²Ù×÷£¬¶øÇÒ¸ü¼Ó½ÚÔ¼ÄÚ´æ¿Õ¼ä¡£·Ï»°²»¶à˵
ÁË£¬»¹ÊÇÏÈÀ´¿´¿´ËüµÄÕæÃæÄ¿°É£º
bit-fieldÀ´Ô´:
bit-fieldÊÇΪÁ˽ÚÔ¼´æ´¢¿Õ¼ä¶ø´´ÔìµÄÒ»ÖÖÊý¾Ý½á¹¹(to pack several objects into a single
machine word)
 
bit-fieldÓÃ;:
Externally-imposed data formats,such interfaces to hardware
devices,also often
require the ability to get a pieces of a word
 
¶¨Òå·½·¨:
struct (tag) {
bit-field list ~~~
} bit-field variable list;
 
Óɶ¨Òå·½·¨¿É¼û£¬bit-fieldÒ²ÊÇÒÔstructureµÄÐÎʽ×éÖ¯ÆðÀ´µÄÊý¾Ý½á¹¹£¬Ö»²»¹ýÊÇÒÔ¶þ½øÖƽøÐзַ¢
µÄ¶øÒÑ¡£ÆäÖÐbit-field list±íʾ·½·¨£º type fieldnamme:width;
width:fieldµÄ¿í¶È£¬ÒÔbit
±íʾ£¬»¹ÊǾٸöÀý×ÓÀ´¿´°É£º
 
struct bf{
unsigned int is_keyword:1;
unsigned int is_extern:1;
unsigned int is static:1;
}flags;
 
¶¨ÒåÁËÒ»¸öbit-field±äÁ¿flags£¬Ëü°üÀ¨3¸ö1-bitµÄfield£¬·ÃÎÊbit-fieldÆäʵºÍ·ÃÎÊÒ»°ãÊý¾Ý½á
¹¹µÄ³ÉÔ±Ò»Ñù£¬ÀýÈ磺
flags.is_static=0;
 
ÔÚ¶¨Òåbit-fieldµÄʱºò£¬ÓÐÒÔϼ¸µãҪעÒâ(K&R°æ±¾µÄ¹Ûµã)
1¡¢Almost everything about fields is implemention-dependent !
Whether a field may
   overlap a word boundary is implemention-defined.
2¡¢Fields can only be declared as intS,for protability,specify
signed or unsigned
   explicitly.
3¡¢unnamed field can be used for padding£¨Ã»ÓÐÃû×ÖµÄfield¿ÉÒÔÓÃÀ´×÷ΪÌî³ä»òÕßµ÷ÕûÓÃ)
   ÀýÈ磺
   struct bf{
   unsigned int a:2;
   unsigned int  :4; /*¸Ã4λ²»ÄÜÓÃ*/
   unsigned int b:2;
   };
 
 4¡¢Special width 0 may be used to force alignment at the next word
boundary.
   (Èç¹ûwidth=0µÄ»°£¬ÄÇôÏÂÒ»¸öfield¾Í±»Ç¿ÖÆ´æ·ÅÔÚÏÂÒ»¸öÄÚ´æµ¥ÔªÀïÃæÁË),ÀýÈç:
  
   struct bf{
   unsigned int a:2;
   unsigned int  :0; /*¿ÕµÄfield*/
   unsigned int b:2


Ïà¹ØÎĵµ£º

[C´úÂë]ͨѶ¼

/*****************test.c****************/
#include <stdio.h>
#include <stdlib.h>
#include "addr.h"
int main()
{
 int flag=1;
 while(flag)
 {
  switch(choose_menu())
  {
  case 1:add_person();break;
  case 2:show_person_in ......

C/C++ Îļþ¶Áд²Ù×÷×ܽá

ÔÚ±à³ÌµÄ¹ý³ÌÖУ¬ÎļþµÄ²Ù×÷ÊÇÒ»¸ö¾­³£Óõ½µÄÎÊÌ⣬ÔÚC++BuilderÖУ¬¿ÉÒÔʹÓöàÖÖ·½·¨¶ÔÎļþ²Ù×÷£¬ÏÂÃæÎҾͰ´ÒÔϼ¸¸ö²¿·Ö¶Ô´Ë×÷Ïêϸ½éÉÜ£¬¾ÍÊÇ£º
1¡¢»ùÓÚCµÄÎļþ²Ù×÷£»
2¡¢»ùÓÚC++µÄÎļþ²Ù×÷£»
3¡¢»ùÓÚWINAPIµÄÎļþ²Ù×÷£»
4¡¢»ùÓÚBCB¿âµÄÎļþ²Ù×÷£»
5¡¢ÌØÊâÎļþµÄ²Ù×÷¡£
¡¡
Ò¼¡¢»ùÓÚCµÄÎļþ²Ù×÷
¡¡¡¡ÔÚANSI CÖУ¬ ......

[תÔØ] Lua ÖÐÓë C ²»Í¬µÄÉè¼Æ

¾¡¹Ü Lua µÄ¹Ø¼ü´ÊµÄÉè¼Æ£¬ÔËÐзûµÄÉè¼Æ£¬Óï·¨µÄÉè¼ÆµÈ·½ÃæÓë C ºÜÏàËÆ£¬µ«ÎÒÃÇ»¹Òª×¢ÒâÆäÃ÷ÏÔ²»Í¬µÄµØ·½¡£
Ìõ¼þÅжÏʱµÄÕæ¼ÙÌõ¼þ
Lua ÖÐËùÓеÄÖµ¶¼¿ÉÒÔ×÷ΪÌõ¼þ¡£ÔÚ¿ØÖƽṹµÄÌõ¼þÖгýÁË false ºÍ nil Ϊ¼Ù£¬ÆäËûÖµ¶¼ÎªÕæ¡£ËùÒÔ Lua ÈÏΪ 0 ºÍ ¿Õ´® ¶¼ÊÇÕæ¡£
¶ø C ÖУ¬ÈÏΪֻҪÊÇÔÚÄÚ´æÖбíÏÖΪ 0 ÖµµÄ·ûºÅ¶¼Îª¼Ù¡£
×Ö ......

ÈçºÎÖÕÖ¹Ï̵߳ÄÔËÐУ¨C/C++£©

ÈçºÎÖÕÖ¹Ï̵߳ÄÔËÐУ¨C/C++£©
ÏëÒªÖÕÖ¹Ï̵߳ÄÔËÐУ¬¿ÉÒÔʹÓÃÒÔÏ·½·¨£º
1¡¢Ï̺߳¯Êý·µ»Ø£¨×îºÃʹÓø÷½·¨£©¡£
2¡¢Í¨¹ýµ÷ÓÃExitThreadº¯Êý£¬Ï߳̽«×ÔÐг·Ïû£¨×îºÃ²»Ê¹Óø÷½·¨£©¡£
3¡¢Í¬Ò»¸ö½ø³Ì»òÁíÒ»¸ö½ø³ÌÖеÄÏ̵߳÷ÓÃTerminateThreadº¯Êý£¨Ó¦±ÜÃâʹÓø÷½·¨£©¡£
4¡¢ExitProcessºÍTerminateProcessº¯ÊýÒ²¿ÉÒÔÓÃÀ ......

ʹÓÃCÓïÑÔÀ©Õ¹Python(¶þ)

ÔÚÉÏһƪÖÐÎÒÃÇÒѾ­Ê¹ÓÃcÓïÑÔʵÏÖÁËÒ»¸ö×î¼òµ¥µÄÀ©Õ¹Ä£¿é£¬ÕâһƪÖн«ÔÚÆä»ù´¡ÉϽøÐй¦Äܵķḻ¡£Ê×ÏÈÀ´¿¼ÂÇÈçºÎ´ÓÍⲿµÄPythonÏòCÄ£¿é´«µÝ½ø²ÎÊý£¬foo_bar2չʾÁËÈçºÎÏòCÄ£¿é´«µÝÕûÊý£¬¸¡µãÊý£¬×Ö·û´®Èý¸ö²ÎÊý£¬ÆäÖÐ"ids"Ö¸Ã÷ÁË´«Èë²ÎÊýµÄÊý¾ÝÀàÐÍ¡£PyArg_ParseTuple¸ºÔð¶Ôargs½øÐнâÎö£¬Èô½âÎöʧ°ÜÔò·µ»Ø0.´úÂë#include&n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ