Questions tagged [compiler-options]

Compiler-options are parameters that are being passed to the compiler and that affect the compilation process or its resulting product.

Modern compilers have a large set of options that can be used to somehow change the way the code is compiled. Usually those options are passed as command-line flags.

Example for Java:

javac -target 1.5 -bootclasspath jdk1.5.0\lib\rt.jar \ -extdirs "" OldCode.java

More information about particular options can be found on compiler vendor's websites, to name a few:

244 questions
4
votes
2 answers

Can I tell my compiler to ignore the side effects of a statement or a function?

Suppose my code has the following function: inline int foo() { bar(); int y = baz(); return y; } and suppose that bar() and baz() have side-effects. If I write: int z = foo(); printf("z is %d\n", z); then obviously both bar() and baz()…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
4
votes
2 answers

Can g++ check the throw specifiers?

Two questions about this : Is there a way to force g++ to ignore the throw specifiers ? (for example, as I remember, Visual Studio ignores the throw specifiers, different from throw()) Is it possible to force g++ to check if the throw specifiers…
Kiril Kirov
  • 37,467
  • 22
  • 115
  • 187
4
votes
3 answers

target_compile_definitions for multiple CMake targets?

I've been told it's bad practice to do things like seting CFLAGS directly in CMake, and that, instead, I should use the target_compile_definitions() command. Ok, but - what if I want to use similar/identical definitions for multiple (independent)…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
4
votes
1 answer

Why is the stack segment executable on Raspberry Pi?

I have a Raspberry Pi 3 with the Raspbian GNU/Linux 8 (Jessie) OS. I wrote this simple program. I compiled it with gcc -o hello hello.c. #include void main(){ printf("hello!\n"); } From from the readelf output everything seems…
Livio
  • 205
  • 1
  • 3
  • 9
4
votes
2 answers

VC++ .Net Clr/Safe and Clr/Pure

In VC++ .Net, The What does the Clr/Safe (/clr:safe) and Clr/Pure (/clr:pure) means?
4
votes
2 answers

Can I pass VisualStudio Edition name through a compiler option?

I am using Microsoft.QualityTools.Testing.Fakes to mock some unit tests. But this assembly is only available to users with VisualStudio Ultimate. Users with other editions (Professional) can't build and run this test project, and it gives an error…
4
votes
2 answers

make file preprocessor directive

I am not very experienced with make files and am trying to define a preprocessor variable in my make file,in Eclipse (linux). It turns up a non trivial task,since as it seems am missing something... Bellow you can find my make file's structure: …
Rizias
  • 211
  • 6
  • 12
4
votes
3 answers

Code with and without -std=c99 produces different results (UMAC AE implementation)

Long (really long) story short - I use Ted Krovetz's implementation for calculating UMAC and for UMAC AE encryption (http://www.fastcrypto.org/). When I compile my code (and/or the tests in umac.c) with -std=c99, the calculated UMAC is COMPLETELY…
Kiril Kirov
  • 37,467
  • 22
  • 115
  • 187
4
votes
2 answers

What compile options of clang change their default between Objective C and Objective C++?

I was reading the clang documentation on reference counting, which says that “ By default in Objective-C, ARC is not exception-safe”. It proceeds to say: A program may be compiled with the option -fobjc-arc-exceptions in order to enable these, or…
Jean-Philippe Pellet
  • 59,296
  • 21
  • 173
  • 234
4
votes
1 answer

Compiling with /O2 versus /Ox -- which is faster (as a rule of thumb)?

This question and MSDN seem to imply that /O2 would be faster, but if you look at Microsoft's own SafeInt class, you will notice it says: 1) Compile optimized code - /Ox is best, /O2 also performs well. Interestingly, /O1 (optimize for size)…
user541686
  • 205,094
  • 128
  • 528
  • 886
4
votes
3 answers

What is the specific GCC flag that turns on immediate value propagation for inline assembly parameters?

Consider the following x86 code example: #include static int i; static inline __attribute__((always_inline)) test(int x) { asm volatile("mov %1, %0" : "=r"(i): "i"(x)); } int main(void) { test(5); return i; } If I build…
gby
  • 14,900
  • 40
  • 57
4
votes
3 answers

'/fp:fast' and '/Za' not compatible Visual C++

I am stuck with a problem in Visual 2008 SP1. The compiler yields: '/fp:fast' and '/Za' are not compatible The problem is that i did NOT use /Za in the properties.. so I don't get why there should be a conflict when the option isn't set. here is…
djfoxmccloud
  • 571
  • 1
  • 9
  • 23
3
votes
1 answer

When and where is _DEBUG defined?

I have the following sample code in one of my header files: #ifdef _DEBUG #define _DEBUG_NEW_REDEFINE_NEW 0 #include "debug_new.h" #else #define DEBUG_NEW new #endif The application which includes this header file is compiled using gcc compiler…
nitin_cherian
  • 6,405
  • 21
  • 76
  • 127
3
votes
2 answers

Can you get the compiler's command-line contents from within the compiled program?

For silly reasons, I am required to have a string with the options the compiler executable got embedded in the program I'm compiling. This can be achieved by the build system or build-system-generator, albeit in an ugly way; but I was wondering if I…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
3
votes
0 answers

How do I allow allow "import.meta.*" in Typescript?

The Typescript compiler is kicking back my index.ts with the following errors: index.ts:13:34 - error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. 13 const __filename =…