Last update September 14, 2009

Doc Comments /

Conditional Compilation    

Table of contents of this page
Conditional Compilation   
Extra Predefined Versions   
Clarification on setting debug and version in source code   


Add your comments here...

Extra Predefined Versions    

These versions should be predefined:

Compiler Vendors:

  • X86 (Intel and AMD 32 bit processors)
  • X86_64 (AMD and Intel 64 bit processors)
    • AMD64 (AMD 64 bit processors, not an actual D version)
    • EM64T (Intel 64-bit extensions, not an actual D version)
  • PPC (for PowerPC 32 bit processors)
  • PPC64
  • SPARC (for SPARC 32 bit processors)
  • SPARC64
Operating Systems:
  • Windows (odd spelling)
    • Win32 (API)
      • Windows 95
      • Windows 98
      • Windows ME
      • Windows NT
      • Windows 2000
      • Windows XP
    • Win64 (64-bit version of Win32 API, not an actual D version)
      • Windows XP
    • WinFX (managed future API, not an actual D version)
      • Windows Vista
  • Unix (this version is missing from DMD)
Pointer Size: (missing from DMD)
  • GNU_BitsPerPointer32 (size_t.sizeof == uint.sizeof)
  • GNU_BitsPerPointer64 (size_t.sizeof == ulong.sizeof)
Byte Order:
  • LittleEndian (least significant byte first, e.g X86)
  • BigEndian (most significant first, e.g. PPC)
  • none (Never defined)
  • all (Always defined)
Language Features:
  • D_InlineAsm_X86 (Inline assembler, asm { }, is implemented and the processor is X86)
  • D_Coverage (Coverage analyser is implemented and the -cov switch is thrown)

Clarification on setting debug and version in source code    

You can set the version and debug from within your source code, but it must be done at the module level. That is, it must be done outside of any function, class or struct definition.

 module myapp;
 version = 6;  // legal
 debug = qwerty; // legal

void someFunc() { debug = 2; // Error }

class Foo { version = test; // Error }

When you are setting debug or version levels, each statement overrides any previous statements in the module.
  debug = 2;  // Now set to 2.
  debug = 1;  // Now changes from 2 to 1.
However, any version or debug levels set from the command line, will only override these statements if the command line value is greater than the level set from within the module. If a file contains ...
  debug = 3;
but it is compiled with -debug=5 then the debug level is set to 5. However, if it is compiled with -debug=2 then the debug level is set to 3 (from the source file).


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: September 14, 2009 16:39 (diff))