[Issue 6857] Precondition contract checks should be statically bound.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 7 12:16:07 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=6857



--- Comment #68 from Walter Bright <bugzilla at digitalmars.com> 2012-05-07 12:17:19 PDT ---
(In reply to comment #66)
> (In reply to comment #63)
> > > Can't this be solved by simply making all struct parameters to the in/out
> > > functions ref?
> > 
> > Losing all C ABI compatiblity in the process.
> 
> Contracts don't exist in C - so what's there to lose?

1. pass by ref is semantically very different from pass by value. It is
necessary to support both.

2. D supports using C calling conventions, including having contracts on
functions callable from C.

> > How do you forward a variadic function? You don't know what's on the stack to
> > forward.
> 
> How do you implement a variadic function at all without knowing this?

See printf, an example of where such knowledge is known by the programmer, not
the language semantics.

Just for fun, I suggest you try to implement a "myprintf" function which
forwards all its arguments to printf.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list