pragma

#pragma mark not listing the first group name

血红的双手。 提交于 2019-12-03 04:45:06
I'm using #pragma mark for grouping my methods under certain categories. But the issue is in Xcode 4 my first category is not displaying. My code looks like: @interface MyClass : NSObject #pragma mark - #pragma mark Category 1 //Some method declaration #pragma mark - #pragma mark Category 2 //Some method declaration #pragma mark - #pragma mark Category 3 //Some method declaration @end But when I check on Xcode It displays only Category 2 and Category 3. Category 1 is not listed there, please check the Image Is there any issue in my code or is it a bug in XCode ? Yes it is a Bug here. But you

Is there any reason not to use the INLINABLE pragma for a function?

北慕城南 提交于 2019-12-03 04:04:45
问题 The documentation states: An {-# INLINABLE f #-} pragma on a function f has the following behaviour: While INLINE says "please inline me", the INLINABLE says "feel free to inline me; use your discretion". In other words the choice is left to GHC, which uses the same rules as for pragma-free functions. Unlike INLINE, that decision is made at the call site, and will therefore be affected by the inlining threshold, optimisation level etc. Like INLINE, the INLINABLE pragma retains a copy of the

Relative path with #pragma comment(lib)

假如想象 提交于 2019-12-03 03:36:38
Using Visual Studio 2010, I'd like to specify a path in a #pragma comment(lib) relative to the cpp file including it. I tried #pragma comment(lib, __FILE__"\\..\\foo.lib") in foo.cpp and it seems to work. However, this appears hackish to me. Is there a less hackish way? No, not if this needs to be relative from a .cpp file. Which is pretty unusual, you cannot normally guarantee that a .lib got deployed in a directory that's relative from a client source code that uses the library. Although you can certainly give install instructions that stipulate this. The normal way is to just specify "foo

What does #pragma once mean in C? [duplicate]

随声附和 提交于 2019-12-02 19:26:58
Possible Duplicate: #pragma - help understanding I saw the pragma many times,but always confused, anyone knows what it does?Is it windows only? Ptival http://gcc.gnu.org/onlinedocs/cpp/Pragmas.html -- also, it's pragma , not pragama , and a search for pragma on Stack Overflow would have helped you cf. Use of #pragma in C and many others... In the C and C++ programming languages, #pragma once is a non-standard but widely supported preprocessor directive designed to cause the current source file to be included only once in a single compilation. Thus, #pragma once serves the same purpose as

How do I show the value of a #define at compile time in gcc

[亡魂溺海] 提交于 2019-12-02 19:14:11
So far I've got as far as: #define ADEFINE "23" #pragma message ("ADEFINE" ADEFINE) Which works, but what if ADEFINE isn't a string? #define ADEFINE 23 #pragma message ("ADEFINE" ADEFINE) causes: warning: malformed ‘#pragma message’, ignored Ideally I'd like to be able to deal with any value, including undefined. To display macros which aren't strings, stringify the macro : #define STRINGIFY(s) XSTRINGIFY(s) #define XSTRINGIFY(s) #s #define ADEFINE 23 #pragma message ("ADEFINE=" STRINGIFY(ADEFINE)) If you have/want boost , you can use boost stringize to do it for you: #include <boost

How to Expose C Static Library to .Net?

陌路散爱 提交于 2019-12-02 14:47:58
问题 What are the steps to expose C++ functions to C and .Net? I want to use the same function names in C++, C and .Net for 32-bit and 64-bit builds. I'm posting this question and answer because I haven't found these techniques documented anywhere. 回答1: The steps are: Expose C++ functions as a C static library (.lib). Use #pragma statements to project the lib's functions into a DLL. Use .Net's DllImport attribute to expose the DLL's functions. For an example, see this github project. Step 1.

What is the significance of #pragma marks? Why do we need #pragma marks?

ぃ、小莉子 提交于 2019-12-02 13:48:24
What is the purpose of #pragma marks in Xcode? Does their location in .m files matter? Should some #pragma come before all others? Do they have to be present? Can new marks be added? Why would they be? What causes it? Is there any harm in having a mark removed? Would one ever want to? Erre Efe #pragma mark directives show up in Xcode in the menus for direct access to methods. They have no impact on the program at all. For example, using it with Xcode 4 will make those items appear directly in the Jump Bar. There is a special pragma mark - which creates a line. dayitv89 #pragma mark is used to

Can anyone please tell me the use of pragma statements

怎甘沉沦 提交于 2019-12-02 11:48:06
问题 Can anyone please tell me the use of pragma in C and Ada, with some examples if possible. 回答1: There are three standard pragmas in C99: #pragma STDC FP_CONTRACT on-off-switch #pragma STDC FENV_ACCESS on-off-switch #pragma STDC CX_LIMITED_RANGE on-off-switch Where 'on-off-switch' is one of ON, OFF, DEFAULT. These can be used at compile time to modify the behaviour of the compiler in arcane ways (these ones are related to the C99 floating point behaviour). The standard reserves STDC for

gcc equivalent of #pragma comment

南笙酒味 提交于 2019-12-02 07:46:34
问题 I'm trying to write a macro that adds a comment to an executable with the gcc compiler. This is not for linking purposes, I simply want to add text comments. Is there a #pragma comment equivalent in gcc for this purpose? 回答1: I'm not sure what it means to "add a comment to an executable". Who or what is going to consume, display, or even notice such comments? Nevertheless, if you just want to ensure some string is embedded somewhere in your program, then simply declare it as an ordinary (C)

gcc equivalent of #pragma comment

白昼怎懂夜的黑 提交于 2019-12-02 03:08:08
I'm trying to write a macro that adds a comment to an executable with the gcc compiler. This is not for linking purposes, I simply want to add text comments. Is there a #pragma comment equivalent in gcc for this purpose? I'm not sure what it means to "add a comment to an executable". Who or what is going to consume, display, or even notice such comments? Nevertheless, if you just want to ensure some string is embedded somewhere in your program, then simply declare it as an ordinary (C) string at file scope. static const char my_comment[] = "This comment should appear in the compiled executable