pragma

When to use include guards or #pragma once C++ [closed]

删除回忆录丶 提交于 2019-12-22 05:09:18
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . Is it good practice to use your choice of either/both include guards and #pragma once in every header file, or just those with something such as a class declaration? I am tempted to put it in every header, but I'm afraid it would be unneeded and only add to the compile time.

Android SQLite - changing journal_mode

时光总嘲笑我的痴心妄想 提交于 2019-12-21 18:13:00
问题 I am trying to alter the journal_mode for my database, through code. I tried SQLiteDatabase.execSQL("PRAGMA journal_mode=OFF") but it fails because, the expression "PRAGMA journal_mode=OFF" returns a result (I verified this from the terminal), and so Android thinks this is a query and complains that I should be using execQuery instead. But what I am trying to execute isn't a query. I also tried compiling the pragma expression to a SQLiteStatement and invoked the execute method, but same

Why “pragma GCC diagnostic push” pop warning in GCC/C++?

拟墨画扇 提交于 2019-12-21 12:15:10
问题 #pragma GCC diagnostic push it pop: warning: expected [error|warning|ignored] after â#pragma GCC diagnosticâ Why? I use GCC in Linux. I have one question, if I can't use pop/push, if the ignore only influence the compiled cpp, not influence other cpp? if some other include the cap, if influence it? 回答1: #pragma GCC diagnostic push and #pragma GCC diagnostic pop were added in gcc 4.6. You're using an older version. These pragmas are typically used in conjunction with other #pragma GCC

Should I still use #include guards AND #pragma once?

会有一股神秘感。 提交于 2019-12-21 06:46:20
问题 http://en.wikipedia.org/wiki/Pragma_once Should I still use include guards when all of these compilers support #pragma once ? A lot of responses on stack overflow say to use both for compatibility, but I'm not sure if that still rings true. What compilers today don't support #pragma once ? I am not sure if using both was just a recommendation before it became widley adopted, or if there are still very good reasons to use both methods. Any examples of when only using #pragma once will cause

Android database corrupt, but can open in SQLite Manager. Recoverable?

天大地大妈咪最大 提交于 2019-12-21 03:34:18
问题 In the latest two weeks, without releasing an update to my app, I have started getting a bunch of reports with corrupted databases. Below is the stacktrace. Android cannot open the database, and neither could the sqlite-manager program on my computer. However, the SQLite manager-addon to firefox could open it. After running the command "compact database", the database was fixed and I could open it in android. Is there any way I could do something like this within my app? The big problem is

Any way to group methods in Java/Eclipse?

▼魔方 西西 提交于 2019-12-21 03:20:50
问题 I would like to be able to group similar methods and have them appear in my Outline view in Eclipse. This makes navigating large swaths of code a little easier on the eye, and easier to find methods you need. In Objective-C there was a pragma mark command that you could set. Anything like that for java/eclipse? 回答1: I use the Coffee Bytes plugin for code folding, specifically configuring it for folding code that has start and end tags. Although the plugin is not downloadable off the page

#pragma mark not listing the first group name

有些话、适合烂在心里 提交于 2019-12-20 17:29:26
问题 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

What is the purpose of #pragma aux and how should I use it?

ぃ、小莉子 提交于 2019-12-20 07:58:10
问题 I'm attempting to delayload a library and use GetProcAddress to get a function from the library to use repeatedly. The project I'm working on has examples of how this being done in other cases, and in the header file that describes typedefs of the function, there is a #pragma aux line. What does this do? Is this always necessary? EDIT: I'm using the vc11 compiler 回答1: These are auxiliary pragmas and it is specific feature for Watcom compiler. From below detailed explanation: http://users.pja

C++ pragma GCC system_header directive

☆樱花仙子☆ 提交于 2019-12-19 08:28:13
问题 What this C++ directive do: "#pragma GCC system_header"? 回答1: I googled and got this: #pragma GCC system_header This pragma takes no arguments. It causes the rest of the code in the current file to be treated as if it came from a system header. Section 2.7 System Headers. More info on System headers 2.7. System Headers The header files declaring interfaces to the operating system and runtime libraries often cannot be written in strictly conforming C. Therefore, GCC gives code found in system

Disable structure padding in C without using pragma

你。 提交于 2019-12-19 05:20:28
问题 How can I disable structure padding in C without using pragma? 回答1: There is no standard way of doing this. The standard states that padding may be done at the discretion of the implementation. From C99 6.7.2.1 Structure and union specifiers , paragraph 12: Each non-bit-field member of a structure or union object is aligned in an implementation-defined manner appropriate to its type. Having said that, there's a couple of things you can try. The first you've already discounted, using #pragma