CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

多练练英语水平对你也有好处:)

楼主showmetheway(雪儿甜心)2003-02-02 10:38:13 在 VC/MFC / 基础类 提问

#pragma   token-string  
   
  The   token-string   is   a   series   of   characters   that   gives   a   specific   compiler   instruction   and   arguments,   if   any.   The   number   sign   (#)   must   be   the   first   non-white-space   character   on   the   line   containing   the   pragma;   white-space   characters   can   separate   the   number   sign   and   the   word   pragma.   Following   #pragma,   write   any   text   that   the   translator   can   parse   as   preprocessing   tokens.   The   argument   to   #pragma   is   subject   to   macro   expansion.  
   
  If   the   compiler   finds   a   pragma   it   does   not   recognize,   it   issues   a   warning,   but   compilation   continues.  
   
  Pragmas   can   be   used   in   conditional   statements,   to   provide   new   preprocessor   functionality,   or   to   provide   implementation-defined   information   to   the   compiler.   The   C   and   C++   compilers   recognize   the   following   pragmas:  
   
  alloc_text       comment       init_seg1       optimize    
  auto_inline       component       inline_depth       pack    
  bss_seg       data_seg       inline_recursion       pointers_to_members1    
  check_stack       function       intrinsic       setlocale    
  code_seg       hdrstop       message       vtordisp1    
  const_seg       include_alias       once       warning    
   
  //////////////////////////////  
  敢问各位个大哥,以上所述到底是什么个意思? 问题点数:0、回复次数:22Top

1 楼showmetheway(雪儿甜心)回复于 2003-02-02 14:19:38 得分 0

怎么了?都回家过年了吗?  
  一滴水和刀哥怎么连人影都不见了?Top

2 楼AthlonxpX86(一坨屎)回复于 2003-02-02 14:31:41 得分 0

先说说从那找的(MSDN?),我的E文很差,的找到相关文章我才好翻译啊Top

3 楼AthlonxpX86(一坨屎)回复于 2003-02-02 14:33:18 得分 0

应该是与编译指令中的什么东西吧Top

4 楼showmetheway(雪儿甜心)回复于 2003-02-02 15:52:21 得分 0

AthlonxpX86(一滴水)   :  
      #pragma   这个你以前没见过?Top

5 楼liufucsdn(乞力马扎罗的雪)回复于 2003-02-02 16:20:44 得分 0

我也不知道!Top

6 楼everandforever(Forever)回复于 2003-02-02 19:18:36 得分 0

#pragma   命令行  
   
  命令行是一系列的字符,用以给予编译器指示和参数。如果程序中有“pargma”这么一行,那么它的第一个   非空格(NON-WHITE-SPACE)字符(比如   空格,TAB   等等)   必须是“#”。空格符可以用来分隔数字和字符参数。在   #pragma   后面,可以写上任何翻译器可以认出的命令。Top

7 楼everandforever(Forever)回复于 2003-02-02 19:22:02 得分 0

 
  如果编译器碰到一个不认识的命令,它只产生一个警告,但编译继续。  
   
  pragma   可以用在条件编译中,用来提供新的预编译功能,或者向编译器提供预先定义的编译条件。   C   和   C++   编译器认识下列参数:  
   
  ...  
  ________  
  I   LIKE   GIRLS.Top

8 楼kingcom_xu(冷羽)回复于 2003-02-02 19:28:25 得分 0

你们都是绅士:)Top

9 楼Cline(营营[无意苦争春,贯看群芳谢])回复于 2003-02-02 19:54:34 得分 0

举个例,比如pack  
  #pragma   pack.....  
  它能告诉编译器数据的对齐方式。  
   
  如结构  
  struct   TestStruct  
  {  
      char   a;  
      int   b;  
  }  
  如对齐方式为一个字节,那么sizeof(TestStruct)==5,如果为四字节,那么sizeof(TestStruct)==8;  
  Top

10 楼showmetheway(雪儿甜心)回复于 2003-02-03 02:22:05 得分 0

pack是什么意思也不知道,我还是先把刀磨快点(磨到有刀哥的一半快)再来问这个问题吧:)Top

11 楼everandforever(Forever)回复于 2003-02-03 02:45:02 得分 0

字节对齐问题。你会碰到的。Top

12 楼AthlonxpX86(一坨屎)回复于 2003-02-03 02:47:53 得分 0

请尊敬的everandforever(Forever)老师给我们好好讲一课,  
  我一定做个好学生,这些问题我真的不知道啊Top

13 楼everandforever(Forever)回复于 2003-02-03 02:59:38 得分 0

字节对齐你也不知道?如   Cline(营营)   所说:  
   
  结构  
  struct   TestStruct  
  {  
      char   a;  
      int   b;  
  }  
  如对齐方式为一个字节,那么sizeof(TestStruct)==5,   如果为四字节,那么sizeof(TestStruct)==8;Top

14 楼everandforever(Forever)回复于 2003-02-03 03:00:47 得分 0

对了,“老师”的确是真不敢当。Top

15 楼AthlonxpX86(一坨屎)回复于 2003-02-03 03:09:23 得分 0

具体怎么算啊,还是不明白Top

16 楼qing_li73(Vincent Lee)回复于 2003-02-03 11:16:15 得分 0

pack  
  #pragma   pack(   [   n]   )  
   
  Specifies   packing   alignment   for   structure   and   union   members.   Whereas   the   packing   alignment   of   structures   and   unions   is   set   for   an   entire   translation   unit   by   the   /Zp   option,   the   packing   alignment   is   set   at   the   data-declaration   level   by   the   pack   pragma.   The   pragma   takes   effect   at   the   first   structure   or   union   declaration   after   the   pragma   is   seen;   the   pragma   has   no   effect   on   definitions.  
   
  When   you   use   #pragma   pack(n),   where   n   is   1,   2,   4,   8,   or   16,   each   structure   member   after   the   first   is   stored   on   the   smaller   member   type   or   n-byte   boundaries.   If   you   use   #pragma   pack   without   an   argument,   structure   members   are   packed   to   the   value   specified   by   /Zp.   The   default   /Zp   packing   size   is   /Zp8.  
   
  The   compiler   also   supports   the   following   enhanced   syntax:  
   
  #pragma   pack(   [   [   {   push   |   pop},   ]   [     identifier,   ]   ]   [   n   ]   )  
   
  This   syntax   allows   you   to   combine   program   components   into   a   single   translation   unit   if   the   different   components   use   pack   pragmas   to   specify   different   packing   alignments.    
   
  Each   occurrence   of   a   pack   pragma   with   a   push   argument   stores   the   current   packing   alignment   on   an   internal   compiler   stack.   The   pragma’s   argument   list   is   read   from   left   to   right.   If   you   use   push,   the   current   packing   value   is   stored.   If   you   provide   a   value   for   n,   that   value   becomes   the   new   packing   value.   If   you   specify   an   identifier,   a   name   of   your   choosing,   the   identifier   is   associated   with   the   new   packing   value.  
   
  Each   occurrence   of   a   pack   pragma   with   a   pop   argument   retrieves   the   value   at   the   top   of   an   internal   compiler   stack   and   makes   that   value   the   new   packing   alignment.   If   you   use   pop   and   the   internal   compiler   stack   is   empty,   the   alignment   value   is   that   set   from   the   command-line   and   a   warning   is   issued.   If   you   use   pop   and   specify   a   value   for   n,   that   value   becomes   the   new   packing   value.   If   you   use   pop   and   specify   an   identifier,   all   values   stored   on   the   stack   are   removed   from   the   stack   until   a   matching   identifier   is   found.   The   packing   value   associated   with   the   identifier   is   also   removed   from   the   stack   and   the   packing   value   that   existed   just   before   the   identifier   was   pushed   becomes   the   new   packing   value.   If   no   matching   identifier   is   found,   the   packing   value   set   from   the   command   line   is   used   and   a   level-one   warning   is   issued.   The   default   packing   alignment   is   8.  
   
  The   new,   enhanced   functionality   of   the   pack   pragma   allows   you   to   write   header   files   that   ensure   that   packing   values   are   the   same   before   and   after   the   header   file   is   encountered:  
   
  /*   File   name:   include1.h  
  */  
  #pragma   pack(   push,   enter_include1   )  
  /*   Your   include-file   code   ...   */  
  #pragma   pack(   pop,   enter_include1   )  
  /*   End   of   include1.h   */  
   
  In   the   previous   example,   the   current   pack   value   is   associated   with   the   identifier   enter_include1   and   pushed,   remembered,   on   entry   to   the   header   file.   The   pack   pragma   at   the   end   of   the   header   file   removes   all   intervening   pack   values   that   may   have   occurred   in   the   header   file   and   removes   the   pack   value   associated   with   enter_include1.   The   header   file   thus   ensures   that   the   pack   value   is   the   same   before   and   after   the   header   file.  
   
  The   new   functionality   also   allows   you   to   use   code,   such   as   header   files,   that   uses   pack   pragmas   to   set   packing   alignments   that   differ   from   the   packing   value   set   in   your   code:  
   
  #pragma   pack(   push,   before_include1   )  
  #include   "include1.h"  
  #pragma   pack(   pop,   before_include1   )  
   
  In   the   previous   example,   your   code   is   protected   from   any   changes   to   the   packing   value   that   might   occur   in   include.h.    
  Top

17 楼showmetheway(雪儿甜心)回复于 2003-02-04 15:02:29 得分 0

本来是一个问题,现在变两个了:)Top

18 楼Cline(营营[无意苦争春,贯看群芳谢])回复于 2003-02-04 15:12:25 得分 0

不,这是MS的编译器之选项耳。Top

19 楼AthlonxpX86(一坨屎)回复于 2003-02-04 15:21:29 得分 0

我们不如专门立个项目来翻译MSDN吧!!!Top

20 楼showmetheway(雪儿甜心)回复于 2003-02-04 21:55:55 得分 0

好建议,你来搞定吧。。Top

21 楼AthlonxpX86(一坨屎)回复于 2003-02-04 22:00:35 得分 0

说笑啊,1000个我也搞不定啊早说过了,我英语连初中都没毕业Top

22 楼Richuen22(Vista)回复于 2003-02-04 22:34:19 得分 0

I   don't   know   English。^_^Top

相关问题

  • 程序员英语水平大比拼!
  • 腾讯ICQ是面向中国的,外国有没有类似的产品,在哪下载,我想拿来练练英语.(不用推荐MSN)
  • 请问通过scjp认证要几级英语水平。
  • 程序员的英语水平必须过6级吗
  • 应聘程序员,都需要很好的英语水平吗?
  • 各位大虾们,请问程序员的英语水平多高才够用?
  • 谁的英语水平好,来看看这句怎么理解(客户的信)
  • 似乎在现在搞这行,英语比编程水平更重要
  • 面试题,近来练练哦
  • 注意,这不是招聘广告:请熟悉java开发且英语水平过硬的进来一看.

关键词

  • c++
  • 编译器
  • 字符
  • pragma
  • teststruct
  • packing
  • zp
  • seg
  • 参数
  • structure

得分解答快速导航

  • 帖主:showmetheway

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo