D Cross Compiler

Iain Buclaw ibuclaw at ubuntu.com
Mon Apr 18 14:16:49 PDT 2011


== Quote from Daniel Green (venix1 at gmail.com)'s article
> On 4/18/2011 5:15 AM, Kagamin wrote:
> > Such feature would be fantastic.
> I don't see this becoming a feature of D for quite some time if ever
> although it would make the enforcement easier.
> Once the subsets are defined the next challenge is enforcing them.  Two
> ideas come to me right now.  Enforcing it by checking object symbols,
> most restrictions would generate some form of standardized symbol
> request.  The other is to use the D frontend and create a sort of lint
> checker.
> > Where belong asserts and bound checks?
> _d_array_bounds does bounds checking.
> _d_assert_msg does asserts.
> That is what I meant by symbol checking.  Since they exist as separate
> features with separate symbols They could be filtered into whatever
> level is most appropriate.  asserts I'd place in kernel  and bounds
> checking in drivers.  Possibly low, but definately high.

Contracts would be out of the picture in kernel mode, and replaced with something
creative. For example:

Code:
  assert(condition);

Userspace:
  // Raise Exception if false
  _d_assert(condition);

Kernel space:
  //  Emit barrier saying that control flow will not pass here. ie: hlt for x86
  if (unlikely(foo))
    unreachable();


More information about the D.gnu mailing list