pragma

linking with a pragma with g++

眉间皱痕 提交于 2019-11-30 09:14:46
In Visual C++, one may link to a library in the code itself by doing #pragma comment (lib, "libname.lib") . Is something similar possible in g++? The Boost Config library has some support for autolinking, using the relevant compiler-specific code for the particular compiler. However, the docs note that the GCC toolchain doesn't support autolinking : Auto-Linking Most Windows compilers and linkers have so-called “auto-linking support,” which eliminates the second challenge. Special code in Boost header files detects your compiler options and uses that information to encode the name of the

#pragma warning disable & restore

∥☆過路亽.° 提交于 2019-11-30 06:54:32
问题 I have used c# to create a First Project. I have many warning errors and all these warning errors are to be single Error(Internal compiler error. See the console log for more information.) For Reducing the warning errors I used #pragma Warning disable . #pragma warning restore front and back of the problematic code. I have doubt that in my final build I should leave that #pragma warning disable & restore as it is in the program; or do I need to remove that? e.g: #pragma warning disable if

gcc memory alignment pragma

柔情痞子 提交于 2019-11-30 03:41:26
问题 Does gcc have memory alignment pragma, akin #pragma vector aligned in Intel compiler? I would like to tell compiler to optimize particular loop using aligned loads/store instructions. to avoid possible confusion, this is not about struct packing. e.g: #if defined (__INTEL_COMPILER) #pragma vector aligned #endif for (int a = 0; a < int(N); ++a) { q10 += Ix(a,0,0)*Iy(a,1,1)*Iz(a,0,0); q11 += Ix(a,0,0)*Iy(a,0,1)*Iz(a,1,0); q12 += Ix(a,0,0)*Iy(a,0,0)*Iz(a,0,1); q13 += Ix(a,1,0)*Iy(a,0,0)*Iz(a,0,1

What does the HTTP header Pragma: Public mean?

我的未来我决定 提交于 2019-11-30 01:39:40
What does the HTTP header Pragma: Public mean? According to the standard , Pragma is implementation dependent (section 14.32), except for no-cache because of its wide use. Cache-Control (section 14.9) is the proper way to control caching. This is what the standard says for a Cache-Control: public : Indicates that the response MAY be cached by any cache, even if it would normally be non-cacheable or cacheable only within a non- shared cache. Useful when you come across this error: http://trac.edgewall.org/ticket/1020 . IE 8 & less seems to like to cache things when they are on a SSL server.

C++: What does #pragma comment(lib, “XXX”) actually do with “XXX”?

时光毁灭记忆、已成空白 提交于 2019-11-30 01:30:01
My background is C# but I have to maintain some legacy (MS) C++. In that codebase I stumpled across: #pragma comment(lib, "OtherLib700.lib") where 700 is some versioning. Besides the lib is a DLL with the same name. I first thought that the program would be dependant upon the DLL but after removing it from the system the program still works. There exists a newer version of the DLL, though, which is named OtherLib900... It seems as though the program 'included' the code of the lib so that it's no longer dependant upon the external DLL. (Or that the program 'automatically' uses the newer DLL...)

#pragma mark not showing in methods in Xcode 4.0

♀尐吖头ヾ 提交于 2019-11-29 16:27:56
问题 In Xcode Version 4.0 I notice that #pragma marks within methods are no longer showing up in the Jump Bar. The only #pragma marks that are showing up are those that are between methods. I was using these #pragma marks to make it easy to quickly organize and get to information that appears in different sections of my tableviews and I would really like to get that functionality back. Anyone know how to get them to appear again? 回答1: I'm also experiencing this problem. A pragma mark added before

Disabling OpenMP pragma statements everywhere in my c++ project

旧街凉风 提交于 2019-11-29 16:11:34
In my c++ project, there are several #pragma omp parallel for private(i) statements. When I try to track down bugs in my code using valgrind, the OpenMP adornments result in "possibly lost" memory leak messages. I would like to totally disable all of the aforementioned #pragma statements so that I can isolate the problem. However, I use omp_get_wtime() in my code, and I do not wish to disable these function calls. So I don't want to totally disable all OpenMP functionality in my project. How can I simply turn off all the #pragma omp parallel for private(i) statements? I use Eclipse CDT to

_Pragma preprocessor operator in Visual C++

北战南征 提交于 2019-11-29 10:47:28
Is there something like the ANSI C operator _Pragma in Visual C++? For example, I'm trying to define the following macro: #ifdef _OPENMP #define PRAGMA_IF_OPENMP(x) _Pragma (#x) #else // #ifdef _OPENMP #define PRAGMA_IF_OPENMP(x) #endif // #ifdef _OPENMP So I can circumvent compiler warnings for unknown #pragma omp ... in older GCC compilers. Is there a similar means available in VisualC++? Yes, but it's two underscores: __pragma I'm not sure about how the omp pragma works, however, here's an example using VC++'s optimize pragma: #define PRAGMA_OPTIMIZE_OFF __pragma(optimize("", off)) // These

What is the use of pragma code section and data section?

隐身守侯 提交于 2019-11-29 07:40:37
What exactly will happen to the data segment and text segment if I use the below two lines in my c source code file? #pragma CODE_SECTION(func1, "Sec1") #pragma DATA_SECTION(globalvar1, "Sec2") Source (contains examples): http://hi.baidu.com/jevidyang/blog/item/6d4dc436d87e3a300b55a918.html Note: #pragma is compiler specific, so syntax may vary for your compiler. The DATA_SECTION pragma allocates space for the symbol in a section called section name. The syntax for the pragma in C could be: #pragma DATA_SECTION (symbol, "section name"); The syntax for the pragma in C++ could be: #pragma DATA

Trouble disabling LLVM optimizations via pragma

两盒软妹~` 提交于 2019-11-29 06:55:32
I have a chunk of code that crashes unless I build with optimizations off. I'm building with LLVM compiler 2.0 I would like to turn off optimizations by wrapping the offending code with a #pragma compiler directive; or turn off optimizations for an entire file. I've been digging in the clang manual and code; but nothing jumps out at me. Does anyone know how to change the optimizations for a single CU (as opposed to for the entire app)? Brad Larson You can set per-file compiler flags in Xcode. In Xcode 4 (which I assume you're using because of the LLVM 2.0 reference), first select the project