D Programming Language 2.0

- Forum
- Wiki
- Search
- Downloads
- Home

Last update Fri Jul 8 22:24:14 2011

# Glossary

BLIT (Block Transfer)
  Also known as BLT, blit refers to copying memory byte by byte. In C, this is referred to as a memcpy operation. The name originated with the BLT instruction on the DEC PDP-10 computer.
CTFE (Compile Time Function Evaluation)
  Refers to the ability to execute regular D functions at compile time rather than at run time.
COW (Copy On Write)
  COW is a memory allocation strategy where arrays are copied if they are to be modified.
Data Race
  One thread reading or writing a memory location while another thread is reading or writing that same location.
Functor
  An user-defined type (struct or class) that defines the function call operator ( in D) and as such can be used similarly to a function.
GC (Garbage Collection)
  Garbage collection is the common name for the term automatic memory management. Memory can be allocated and used, and the GC will automatically free any chunks of memory no longer referred to. In contrast, explicit memory management is where the programmer must carefully match up each allocation with one and only one free.
Higher-order function
  A function that either accepts another function as a parameter, returns a function, or both.
Illegal
  A code construct is illegal if it does not conform to the D language specification. This may be true even if the compiler or runtime fails to detect the error.
Input range
  A type (i.e., a struct or a class) that defines the member functions empty, head, and next. Input ranges are assumed to be strictly one-pass: there is no way to save the state of the iteration in a copy of the range. See also range.
Implementation Defined Behavior
  This is variation in behavior of the D language in a manner that is up to the implementor of the language. An example of implementation defined behavior would be the size in bytes of a pointer: on a 32 bit machine it would be 4 bytes, on a 64 bit machine it would be 8 bytes. Minimizing implementation defined behavior in the language will maximize the portability of code.
NRVO (Named Return Value Optimization)

  NRVO is a technique invented by Walter Bright around 1991 (the term for it was coined later) to minimize copying of struct data. Functions normally return their function return values in registers. For structs, however, they often are too big to fit in registers. The usual solution to this is to pass to the function a hidden pointer to a struct instance in the caller's stack frame, and the return value is copied there. For example:

      struct S { int a, b, c, d; }

      S foo()
      {
          S result;
          result.a = 3;
          return result;
      }

      void test()
      {
          S s = foo();
      }

  is rewritten as:

      S* foo(S* hidden)
      {
          S result;
          result.a = 3;
          *hidden = result;
          return hidden;
      }

      void test()
      {
          S tmp;
          S s = *foo(&tmp);
      }

  This rewrite gives us an extra temporary object `tmp`, and copies the struct contents twice. What NRVO does is recognize that the sole purpose of `result` is to provide a return value, and so all references to `result` can be replaced with `*hidden`. `foo` is then rewritten as:

      S* foo(S* hidden)
      {
          hidden.a = 3;
          return hidden;
      }

  A further optimization is done on the call to `foo` to eliminate the other copy, giving:

      void test()
      {
          S s;
          foo(&s);
      }

  The result is written directly into the destination `s`, instead of passing through two other instances.

opApply
  A special member function used to iterate over a collection; this is used by the ForeachStatement.
opApplyReverse
  A special member function used to iterate over a collection in the reverse order; this is used by the ForeachStatement.
POD (Plain Old Data)
  Refers to a struct that contains no hidden members, does not have virtual functions, does not inherit, has no destructor, and can be initialized and copied via simple bit copies. D structs are POD.
Predicate
  A function or delegate returning a Boolean result. Predicates can be nullary (take no arguments), unary (take one argument), binary (take two arguments), or n-ary (take n arguments). Usually predicates are mentioned within the context of higher-order functions, which accept predicates as parameters.
RAII (Resource Acquisition Is Initialization)
  RAII refers to the technique of having the destructor of a class object called when the object goes out of scope. The destructor then releases any resources acquired by that object. RAII is commonly used for resources that are in short supply or that must have a predictable point when they are released. RAII objects in D are created using the `scope` storage class.
Sequential Consistency
  Data being written in one order in one thread being visible in the same order to another thread.
SFINAE (Substitution Failure Is Not An Error)
  If template argument deduction results in a type that is not valid, that specialization of the template is not considered further. It is not a compile error. See also SFINAE.
TMP (Template Metaprogramming)
  TMP is using the template features of the language to execute programs at compile time rather than runtime.
TLS (Thread Local Storage)
  TLS allocates each thread its own instance of the global data. See also Wikipedia.
UB (Undefined Behavior)
  Undefined behavior happens when an illegal code construct is executed. Undefined behavior can include random, erratic results, crashes, faulting, etc. A buffer overflow is an example of undefined behavior.

Forums | Comments | D | Search | Downloads | Home
Copyright © 1999-2011 by Digital Mars ®, All Rights Reserved | Page generated by Ddoc.