ChinaUnix.net
相关文章推荐:

#pragma CODESECTION

我在程序中加了#pragma宏,把程序编译了一遍,执行时输出了如下信息 [code]xlc@linuxopen:~$ ./a.out 5798: symbol=printf; lookup in file=./a.out 5798: symbol=printf; lookup in file=/lib/tls/i686/cmov/libc.so.6 4[/code] 而再把程序中的#pragma去掉后再编译一遍,执行时还是输出这样的信息,这到底是怎么回事啊? 程序如下: [code] #include #include #pragma int main() { ...

by cugb_cat - C/C++ - 2006-12-31 17:02:13 阅读(1019) 回复(5)

相关讨论

小弟不太清楚#pragma杂注是什么意思,什么时候用到.请各位大哥赐教.

by seeder - C/C++ - 2006-09-27 12:34:39 阅读(1952) 回复(5)

保证头文件只被编译一次有两种方式: 方式一: #ifndef _SOMEFILE_H_ #define _SOMEFILE_H_ .......... // 一些声明语句 #endif 方式二: #pragma once ... ... // 一些声明语句 #ifndef,#define,#endif是C/C++语言中的宏定义,通过宏定义避免文件多次编译。所以在所有支持C++语言的编译器上都是有效的,如果写的程序要跨平台,最好使用这种方式.#ifndef的方式依赖于宏名字不能冲突,这不光可以保证同一个文件不会被包含多次...

by 董力云 - C/C++ - 2013-06-26 10:27:20 阅读(951) 回复(0)

gcc 预编译好像没有此项功能,请教各位大侠:gcc里面有没有可以代替#pragma message功能的命令项。#warning和#error不好用啊,谢谢了

by Reny - Shell - 2010-04-13 14:23:25 阅读(1728) 回复(1)

转载1: #pragma pack(n)解释 转载2: 在C语言中,结构是一种复合数据类型,其构成元素既可以是基本数据类型(如int、long、float等)的变 量,也可以是一些复合数据类型(如数组、结构、联合等)的数据单元。在结构中,编译器为结构的每个成员按其自然对界(alignment)条件分配空间。 各个成员按照它们被声明的顺序在内存中顺序存储,第一个成员的地址和整个结构的地址相同。 例如,下面的结构各成员空间分配情况: struct t...

by centipedecn - Linux文档专区 - 2009-09-21 14:56:11 阅读(1369) 回复(0)

哪位大牛帮忙解释下: pragma operator The _pragma operator allows you to code pragma directives in macros. In the following example, the declaration of struct S and the definition of its instance s are surrounded by two macros, PACK_1 and PACK_POP: #define PACK_1 _pragma("pack(1)") #define PACK_POP _pragma("pack(pop)") PACK_1 struct S { char ch; int i; } s; PACK_POP

by zhongf1114 - C/C++ - 2008-06-02 13:30:59 阅读(1120) 回复(0)

#pragma pack(4) 看到的: class TestB   {   public:     int aa; //第一个成员,放在[0,3]偏移的位置,     char a; //第二个成员,自身长为1,#pragma pack(4),取小值,也就是1,所以这个成员按一字节对齐,放在偏移[4]的位置。     short b; //第三个成员,自身长2,#pragma pack(4),取2,按2字节对齐,所以放在偏移[6,7]的位置。     char c; //第四个,自身长为1,放在[8]的位置。   };...

by volter619 - C/C++ - 2008-03-06 13:49:42 阅读(1762) 回复(6)

对于这个语句的用法我有2个疑问,请大家帮助! 1. #pragma pack 是否只能用于 结构体的字节对齐问题。能否用于 class 的字节对齐? 2. 什么情况下用 #pragma pack 语句呢?

by UnixPanther - C/C++ - 2006-11-02 08:38:55 阅读(1251) 回复(2)

Hello ! C/C++ expert , Some time in work , I read C/C++ program , I meet in some configuration file or head file , like: #pragma link C++ class xxxxx can somebody explain the usage of #pragma ?? Thank you very much !

by dreamflying - C/C++ - 2003-07-15 10:12:34 阅读(743) 回复(2)

Normally, local copies of certain information (backup copies of inline member functions, debugging information, and the internal tables that implement virtual functions) must be kept in each object file that includes class definitions. You can use this pragma to avoid such duplication. 本来想用这个pragma减少C++ 程序运行时所需内存size的(目的是减少.text .rodata段的大小),但是用过之后,发现生成的程...

by hzy2hzy - C/C++ - 2013-09-03 10:11:35 阅读(3237) 回复(4)

gcc 预编译好像没有此项功能,请教各位大侠:gcc里面有没有可以代替#pragma message功能的命令项。#warning和#error不好用啊,谢谢了

by Reny - CPU与编译器 - 2010-04-13 14:24:27 阅读(3511) 回复(1)