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
1
vote
0 answers

How to force Visual Studio to use a specific framework version

I have a class library that targets multiple frameworks. i.e. netstandard2.0;netstandard2.1 When msbuild builds my application it correctly spits out both netstandard2.0 and netstandard2.1 assemblies. I'm using…
Matt Ruwe
  • 3,386
  • 6
  • 39
  • 77
1
vote
1 answer

Are there any formalized target framework directives?

I've read Microsoft's article about how to detect target framework, for example : netcoreapp2.2 net47 net58 But there are situations where I don't care about the exact version, but the general framework target : NETCORE .Net Framework But I…
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
1
vote
2 answers

Using compiler directives to support multiple platforms

This is a general software design question. Is it a good idea to use the #if compiler directive to support multiple platforms. For example, I have three files: IScreen.cs public interface IScreen { ... } ScreenWin.cs #if WIN public class Screen…
ehsk
  • 99
  • 9
1
vote
1 answer

What is the best practice for porting #defines from .h file to a C# application?

I am converting an application from C++ to C#. The C++ application has a defines file .h with over 500 #define directives. I would like to represent this data in a Definition.cs file. What is the best way to do this? An example of the…
Ryan R
  • 8,342
  • 15
  • 84
  • 111
1
vote
5 answers

How do I use an If DEBUG statement in C# without the IDE thinking code is unreachable?

I've got some code that needs to work slightly differently in debug and release modes. It has a constant called PrettyPrint that is set to true in some modes and false in others, and I sometimes change those around. #if DEBUG public const…
configurator
  • 40,828
  • 14
  • 81
  • 115
1
vote
0 answers

gfortran compiler directive to add/remove compiler option

I would like to temporarily disable a gfortran compiler option for a piece of Fortran code. I am looking for something like: !GFORTRAN$ PUSH_OPTION(-fcheck=bounds) SUBROUTINE FOO(BAR) INTEGER BAR(*) ! ... END SUBROUTINE FOO !GFORTRAN$…
1
vote
2 answers

What is the conditional compiler directive binded to Delphi XE4 compiler?

What is the conditional compiler directive binded to Delphi XE4 compiler? I though something like this: {$ifdef VerDXE4} code segment compiled only by the Delphi XE4 compiler {$endif}
The Bitman
  • 1,279
  • 1
  • 11
  • 25
1
vote
1 answer

C++ #define value not being read in cpp file

In my C++ .h file: class foo { #define useThis true ... } In my .cpp file: #if useThis ... generate A code #else ... generate B code #endif The problem is that the #define values are not being read in the .cpp file, so what is happening is both A…
Bob Jones
  • 2,049
  • 5
  • 32
  • 60
1
vote
3 answers

system verilog disabling `ifndef blocks in specific instances

In a system verilog design, I have a top-module, sub-module and a sub-sub module. sub-sub module instantiated in sub-module instantiated in top module.Top module also has an instance of sub-sub module.The hierarchy tree is shown below The sub-sub…
vishnu varkala
  • 121
  • 2
  • 2
  • 7
1
vote
1 answer

Controlling compiler directive in file from other file C++

Consider following header file, // filename : packet_types.h #ifndef _PACKET_TYPES_ #define _PACKET_TYPES_ struct Packet { enum Type { typ_ONE, typ_TWO, typ_THREE, }; static…
Oli
  • 1,313
  • 14
  • 31
1
vote
1 answer

How to generate Rtti info for all private/protected Methods?

have been struggling with this problem for a while and can't seem to find a way around it. I am using Delphi XE-2. I need to generate Rtti Info for private/protected Methods for ALL classes in a given package. By default Delphi seems to only…
santiagoIT
  • 9,411
  • 6
  • 46
  • 57
1
vote
1 answer

C++ Builder File Version not correct

I have set the file version in Project->Options->Version Info (yes the "Include version information" is ticked). I have for example FileVersion: 0.95.1.73 set in all release configurations. But when I rebuild, the File version is always set to…
1
vote
1 answer

Delphi CompilerVersion directive issues

I have a library code file which is shared between Delphi 5 and DelphiXE2. I am attempting to add anonymous method functionality to the code file, but only for DelphiXE2 projects (since Delphi 5 doesn't support anonymous methods). It seemed I should…
energ1ser
  • 2,703
  • 4
  • 24
  • 31
1
vote
2 answers

Setting HTML as attributes with directive/$compile

the controller of my module has a property as a string in which I assemble HTML. Within a directive I try to assign the HTML-string to an attribute of tooltip, that is "tooltip-html-unsafe". I am able to assign the whole element to this…
Pille
  • 1,123
  • 4
  • 16
  • 38
1
vote
1 answer

ConditionalAttribute vs Comments

I just read http://msdn.microsoft.com/en-us/library/system.diagnostics.conditionalattribute.aspx. And I'm struggling to understand what the difference is between using [Conditional("CONDITION1")] with/without #define CONDITION1 and just…
David Klempfner
  • 8,700
  • 20
  • 73
  • 153
1 2 3
8 9