Questions tagged [compiler-directives]

Compiler directive is a language construct that specifies how a compiler (or assembler or interpreter) should process its input.

Compiler directive is a language construct that specifies how a compiler (or assembler or interpreter) should process its input.

125 questions
2
votes
4 answers

Pre-processing equivalent for views in RAZOR/MVC 3

I'm looking for the equivalent of an #if DEBUG //view elements to show just for debug builds #if for views in MVC3/Razor. What's the idiomatic method for implementing this type of a setup?
blueberryfields
  • 45,910
  • 28
  • 89
  • 168
2
votes
2 answers

How to change a .dfm property with compiler directives?

Is it possible to make a compiler directive for the .dfm properties introduced on Delphi 11 like {$IFDEF CompilerVersion > 34.0} PixelsPerInch = 96 {$ENDIF} So other developers that use 10.4.2 or lower are able to use the same unit without…
Mobius one
  • 171
  • 3
  • 12
2
votes
1 answer

Visual Studio hotkey detection on run

Weird one maybe. Is there anyway to detect a hotkey combo at run-time after firing up the project in VS. E.g. If I hold shift and press f5 or run in VS then i want to fire a special line of code. If you don't press the hotkey combo then it fires as…
Matt
  • 3,305
  • 11
  • 54
  • 98
2
votes
2 answers

Silencing Unused Static Function Warnings for a Section of Code

In the spirit of What are the consequences of ignoring: warning: unused parameter, but I have static functions that are unused, #include /* EXIT_SUCCESS */ #include /* fprintf */ #define ANIMAL Sloth #include…
Neil
  • 1,767
  • 2
  • 16
  • 22
2
votes
1 answer

How to follow preprocessor directives throughout a compilation

I'm working with a program, full of compiler directives, programmed in Visual Studio. I've made some changes and now I'm stuck with an unresolved external compiler/linker error. I believe this is caused by the compiler directives, which seem not to…
Dominique
  • 16,450
  • 15
  • 56
  • 112
2
votes
3 answers

Localize g++ compile options within code

I'm looking for a simple way to localize certain g++ (g++-4.9 to be specific) compile options to certain lines of code or at least targeted functions. I'm interested generally speaking, but also specifically to the -fast-math, -ffinite-math-only…
codechimp
  • 1,509
  • 1
  • 14
  • 21
2
votes
1 answer

Order of linked libraries in XCode

In an XCode project I have linkend a library (libpng) and a framework (opencv). The framework already contains an older version of my library. Now when I go to XCode in "Link Binary With Libraies", if I put opencv first and libpng second, my code…
Adi
  • 321
  • 1
  • 17
2
votes
1 answer

What framework and compiler directive to use for portable class libary in ASP.NET5?

What framework and compiler directive to use for portable class library in ASP.NET5? For framwwork, that "pcl" ? "pcl": { "frameworkAssemblies": { // ... }, "dependencies": { // ... } } And as compiler directive, is…
Stef Heyenrath
  • 9,335
  • 12
  • 66
  • 121
2
votes
4 answers

Implicit casting Integer calculation to float in C++

Is there any compiler that has a directive or a parameter to cast integer calculation to float implicitly. For example: float f = (1/3)*5; cout << f; the "f" is "0", because calculation's constants(1, 3, 10) are integer. I want to convert integer…
2
votes
4 answers

C programming directives #include printf

I have that simple hello world program. First row it says #include . I googled it and it tells basically the preprocessor to define the functions for input/output. First question: I read that the actually code of the function first compiled…
user3151614
2
votes
1 answer

Can I tell nvcc to apply #pragma unroll to all loops in a function?

I have a CUDA kernel with a bunch of loops I want to unroll. Right now I do: void mykernel(int* in, int* out, int baz) { #pragma unroll for(int i = 0; i < 4; i++) { foo(); } /* ... */ #pragma unroll for(int i = 0;…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
2
votes
2 answers

Rendering html in Angular with Directive

I am storing html data in my database from the output of a WYSIWYG editor. The html also stores the html for some directives. One of them being the ui-bootstrap tooltip: Tooltip text…
Sneaksta
  • 1,041
  • 4
  • 24
  • 46
2
votes
3 answers

@property and @synthesize: why both?

I have been climbing the learning curve of X-code for about two months now. I understand the purpose of the @property/@synthesize directives, but it seems that it is a bit redundant to always declare the properties in the .h file, and then…
John R Doner
  • 2,242
  • 8
  • 30
  • 36
2
votes
2 answers

How to use the #error directive - C++

I'm creating a self initializing arrays class in C++ and I'm wondering how I'd throw an error not an exception if a user were to try and allocate more than 0x7fffffff bytes. Similar to where: error C2148: total size of array must not exceed…
2
votes
0 answers

Can I have gcc ignore #warning directives

I am writing code that links to something that has many #warning directives scattered throughout. Seeing them pop up every time makes it very difficult to notice warnings in my own code. Is there a way to ignore the #warning directive?
f4hy
  • 1,299
  • 3
  • 14
  • 18
1 2 3
8 9