Summary: contracts don't work on function definitions
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Trass3r <> 2010-08-24 05:23:06 PDT ---
The Matlab C headers provide some kind of hand-crafted contracts by defining
extra functions with suffix "_d" that check all the arguments and then
detouring the calls to the original functions via the preprocessor (#define foo

I tried to leverage D's built-in contract programming but it doesn't work:

module externcontracts;
import externcontracts2;
void foo(int a) in {assert(a>=0);}

module externcontracts2;
void foo(int a){}

externcontracts.d(3): Error: function in and out contracts
require function body
externcontracts.d(3): missing body { ... } after in or out
if you put a ';' after the in{} block

Note that this is exactly the same syntax as for interface contracts.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to