compiler-options

What's the difference in GCC between -std=gnu++0x and -std=c++0x and which one should be used?

橙三吉。 提交于 2019-11-30 10:52:09
I'm having troubles with <stdint.h> when using -std=c++0x in GCC 4.4.3 (for Android): // using -std=c++0x #include <stdint.h> uint64_t value; // error: 'uint64_t' does not name a type But using -std=gnu++0x works: // using -std=gnu++0x #include <stdint.h> uint64_t value; // OK Is <stdint.h> incompatible with C++0x? So far as I can tell, I think this could be argued an implementation bug (or actually, since C++0x isn't published, not a bug per se but an incomplete implementation of the current state of the upcoming standard). Here's why, referring to n3225 for the expected behavior of -std=c+

Add GCC options to top of C source file

孤街醉人 提交于 2019-11-30 06:59:46
问题 Is is possible to put something at the top of the C source file, like // GCC_OPTIONS=-g,-Wall that will add those options automatically to gcc every time you compile this file? 回答1: Yes it is, at least for some flags. You can push and pop diagnostic settings like this: #pragma GCC diagnostic error "-pedantic" #pragma GCC diagnostic warning "-Wall" This is also possible for optimization levels on a per-function level: #pragma GCC optimize ("string"...) These #pragma definitions affect all code

When should I use GCC's -pipe option?

拜拜、爱过 提交于 2019-11-29 20:24:05
The GCC 4.1.2 documentation has this to say about the -pipe option: -pipe Use pipes rather than temporary files for communication between the various stages of compilation. This fails to work on some systems where the assembler is unable to read from a pipe; but the GNU assembler has no trouble. I assume I'd be able to tell from error message if my systems' assemblers didn't support pipes, so besides that issue, when does it matter whether I use that option? What factors should go into deciding to use it? It doesn't usually make any difference It has + and - considerations. Historically,

What's the difference in GCC between -std=gnu++0x and -std=c++0x and which one should be used?

送分小仙女□ 提交于 2019-11-29 16:05:50
问题 I'm having troubles with <stdint.h> when using -std=c++0x in GCC 4.4.3 (for Android): // using -std=c++0x #include <stdint.h> uint64_t value; // error: 'uint64_t' does not name a type But using -std=gnu++0x works: // using -std=gnu++0x #include <stdint.h> uint64_t value; // OK Is <stdint.h> incompatible with C++0x? 回答1: So far as I can tell, I think this could be argued an implementation bug (or actually, since C++0x isn't published, not a bug per se but an incomplete implementation of the

How to disable narrowing conversion warnings?

主宰稳场 提交于 2019-11-29 13:19:18
I use -Wall and updating to new gcc I have got a lot of warning: narrowing conversion . I want to disable them, but leave all other warnings untouched (ideally). I can find nothing about narrowing in http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html How to disable narrowing conversion warnings? Is it possible at all? P.S. I need to Disable warnings, not fix them in the source code. Blind -Wno-conversion doesn't help. Stryck As gx_ said, adding -Wno-narrowing to your command line should ignore those errors. Encountered this myself when upgrading to C++0x. 来源: https://stackoverflow.com

How can I understand the fdump-class-hierarchy output

亡梦爱人 提交于 2019-11-29 02:32:05
I'm playing with fdump-class-hierarchy compiler option but I don't know how I can understand the output. What does the "size", "align", "base size" and "base align" mean, and how these are counted? Thanks! When the code is: class A { public: private: double m_nothing; int m_number; }; The output is: Class A size=16 align=8 base size=16 base align=8 A (0x406c690) 0 But, if I change the class a little: class A { public: private: int m_number; double m_nothing; }; the output will be: Class A size=16 align=8 base size=12 base align=8 A (0x406c690) 0 The size and align are the size and alignment of

Add GCC options to top of C source file

老子叫甜甜 提交于 2019-11-28 23:40:15
Is is possible to put something at the top of the C source file, like // GCC_OPTIONS=-g,-Wall that will add those options automatically to gcc every time you compile this file? Matt Joiner Yes it is, at least for some flags. You can push and pop diagnostic settings like this: #pragma GCC diagnostic error "-pedantic" #pragma GCC diagnostic warning "-Wall" This is also possible for optimization levels on a per-function level : #pragma GCC optimize ("string"...) These #pragma definitions affect all code after them in a source file. See these other questions for more information: Switching off

When should I use GCC's -pipe option?

跟風遠走 提交于 2019-11-28 16:13:25
问题 The GCC 4.1.2 documentation has this to say about the -pipe option: -pipe Use pipes rather than temporary files for communication between the various stages of compilation. This fails to work on some systems where the assembler is unable to read from a pipe; but the GNU assembler has no trouble. I assume I'd be able to tell from error message if my systems' assemblers didn't support pipes, so besides that issue, when does it matter whether I use that option? What factors should go into

Disabling C++0x features in VC 2010?

邮差的信 提交于 2019-11-28 13:24:25
Does C++0x mode in VC++ 2010 has an off switch? I am working on a project that supposed to compile on non 0x compilers, and therefore I want to compile against the current standard. (Even if non of the new features are being used directly, there are still subtleties that makes C++0x more premissive). The closest switch I found was Configuration Properties -> C/C++ -> Language -> Disable Language Extensions but that's not it. No, language extensions are typically non-standard vendor specific additions. C++0X features: There is no direct way to switch off these features. One workaround is to not

Get Python's LIB path

折月煮酒 提交于 2019-11-28 08:15:58
问题 I can see that INCLUDE path is sysconfig.get_path('include'). But I don't see any similar value for LIB . NumPy outright hardcodes it as os.path.join(sys.prefix, "libs") in Windows and get_config_var('LIBDIR') (not documented and missing in Windows) otherwise. Is there a more supported way? 回答1: Since it's not a part of any official spec/doc, and, as shown by another answer, there are cases when none of appropriate variables from sysconfig / distutils.sysconfig .get_config_var() are set, the