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
4
votes
3 answers

Avoid debug and callstack for a piece of code in c#

In Delphi the compiler directives {$d-} and {$l-} allow you to effectively avoid generation of debug and local variable information for a defined section of code. In a practical matter that has the effect to "hide" the code from the debug view, it…
Jorge Córdoba
  • 51,063
  • 11
  • 80
  • 130
4
votes
1 answer

How __future__ imports work under the hood

I've been fascinated by the __future__ module - in particular, its ability to change the way statements are parsed in python. What's most interesting is how doing something like from __future__ import print_function Enables you to use print (and…
cs95
  • 379,657
  • 97
  • 704
  • 746
4
votes
2 answers

madExcept required compiler directives

I use madExcept (not from the IDE) but in a automated batch process. Which compiler directives I should switch on in order to have stack trace and line numbers. I do not care about loaded modules, processes or CPU registers. I currently run…
Gad D Lord
  • 6,620
  • 12
  • 60
  • 106
4
votes
1 answer

How to access scope from compiler function directive?

I have a directive building html based on an array sent as attribute. I can't access it from the compiler function of the directive. It works inside the link function, but I need in inside the compile, otherwise new template doesn't get…
Alexandru R
  • 8,560
  • 16
  • 64
  • 98
4
votes
2 answers

What is the purpose of {.$DEFINE VAR} instead of {$DEFINE VAR} in Delphi

What is the difference in Delphi between using {.$DEFINE VAR} and {$DEFINE VAR} compiler directives ?
aleroot
  • 71,077
  • 30
  • 176
  • 213
4
votes
1 answer

What all APIs are affected by {$IOCHECKS OFF}?

We have some ancient Delphi code (might have even originated as Turbo Pascal code) that uses {$I-}, aka {$IOCHECKS OFF}, which makes the code use IOResult instead of exceptions for disk I/O errors. I want to get rid of the {$I-} and bring this code…
Joe White
  • 94,807
  • 60
  • 220
  • 330
3
votes
2 answers

Requesting debug_info in an Erlang module using -compile

I want to force the Erlang compiler to generate debug info for specific modules whenever I compile them, without having to add the debug_info argument to the compilation command. I tried adding -compile([debug_info]). to the module file, but…
Little Bobby Tables
  • 5,261
  • 2
  • 39
  • 49
3
votes
3 answers

Switching between compiler directives in Visual Studio 2019?

I'm using Visual Studio 2019 with SDK based project, with multiple targets: netstandard2.0;net45;net46 But when I write conditional code, I see (obviously) some code in gray and some code in regular colors :…
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
3
votes
3 answers

Swift errors using #if, #endif

Using #if, #endif in Swift (using Xcode) produces errors if it cuts into the flow of an operation. This screenshot says it all: Does anyone know a solution to make this example work, without repeating the entire code block twice? There can easily…
msedore
  • 91
  • 2
  • 10
3
votes
2 answers

Can I deduce the type of a type in a compiler directive

Is it possible to create a conditional define like so: {$if typeof(TNode) = record} type PNode = ^TNode; {$else} type PNode = TNode; {$end} Why do I want this? I'm alternating between using class and record for a specific problem. I want to use…
Johan
  • 74,508
  • 24
  • 191
  • 319
3
votes
1 answer

"Illegal polymorphic or qualified type" in instance declaration (System-F style trees)

I'm experimenting with implementing System-F-style data structures in Haskell. I'll use A to mean application of a term A to a type B just to make it unambiguous (also using capitals for types). Let's say Tree is the type of binary trees…
Oly
  • 2,329
  • 1
  • 18
  • 23
3
votes
0 answers

Why is the compiler not generating any RTTI?

I'm playing around with the OmniThread lib, adding some functionality to the pipeline class. I now want to add some attributes, but for this to work I need the RTTI to be generated. It turns out that RTTI is disabled for all of Otl, by using the…
Johan
  • 74,508
  • 24
  • 191
  • 319
3
votes
5 answers

Removing Delphi IFDEf compiler directives automatically

I am currently working with 'inherited' code that has (scattered randomly throughout) a whole bunch of conditional compiler directives based on the version of Delphi, going back to Delphi 2 . From now on, all development will be with Delphi 2009 or…
HMcG
  • 2,062
  • 4
  • 24
  • 36
3
votes
1 answer

Using compiler directives for conditional attributes

I wish to make an attribute conditional based on compilation mode. For example this is MyFunction() which is decorated with the attribute MyAttribute(): Private Function MyFunction() As Boolean .... End Function However I only…
m.edmondson
  • 30,382
  • 27
  • 123
  • 206
3
votes
2 answers

why is @class used in objective-c

Possible Duplicate: @class May I know the proper use of this I am wondering why @class is used. I have a general understanding that it allows you to access things in that class you call, however I don't know the benefit of it..
C.Johns
  • 10,185
  • 20
  • 102
  • 156
1 2
3
8 9