Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contracts should work function prototypes #17873

Open
dlangBugzillaToGithub opened this issue Aug 1, 2018 · 0 comments
Open

Contracts should work function prototypes #17873

dlangBugzillaToGithub opened this issue Aug 1, 2018 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

Felix Hufnagel (@Zoadian) reported this on 2018-08-01T15:23:56Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=19131

Description

Contracts should work on function prototypes.

Consider a C function like this one from liquid-dsp

/* Create object using Kaiser-Bessel windowed sinc method               */  \
/*  _n      : filter length, _n > 0                                     */  \
/*  _fc     : filter normalized cut-off frequency, 0 < _fc < 0.5        */  \
/*  _As     : filter stop-band attenuation [dB], _As > 0                */  \
/*  _mu     : fractional sample offset, -0.5 < _mu < 0.5                */  \
void _create_kaiser(unsigned int _n,                          \
                                  float        _fc,                         \
                                  float        _As,                         \
                                  float        _mu);                        \

it would be great if we could add contracts directly to our D decleration:

_create_kaiser(uint n, float fc, float As, float mu) in(n > 0) in(0 < fc && fc < 0.5) in(As > 0) in(-0.5 < mu && mu < 0.5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant