Issue 19131 - Contracts should work function prototypes
Summary: Contracts should work function prototypes
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-01 15:23 UTC by Felix Hufnagel
Modified: 2022-12-17 10:31 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Felix Hufnagel 2018-08-01 15:23:56 UTC
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);