Last update September 14, 2009

Doc Comments /
Version



Difference (last change) (no other diffs, normal page display)

Changed: 94c94,97
* Examples: Versioning Category
* Examples: Versioning Category
* DMD versions in source
* LDC versions in source
* GDC versions in source

Conditional Compilation    

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

Messages    

Add your comments here...

Extra Predefined Versions    

These versions should be predefined:

Compiler Vendors:

Processors:
  • 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)
Constants:
  • 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).

Links    


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))