Thread overview | |||||
---|---|---|---|---|---|
|
August 10, 2005 Static Assert? | ||||
---|---|---|---|---|
| ||||
What's the difference between static assert and the normal assert function? -J |
August 10, 2005 Re: Static Assert? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jerry | In article <dddh7r$jof$1@digitaldaemon.com>, Jerry says... > >What's the difference between static assert and the normal assert function? Static assert is evaluated at compile-time. It can be useful to validate template parameters and such. Sean |
August 10, 2005 Re: Static Assert? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | "Sean Kelly" <sean@f4.ca> wrote in message news:dddin6$ld9$1@digitaldaemon.com... > In article <dddh7r$jof$1@digitaldaemon.com>, Jerry says... >> >>What's the difference between static assert and the normal assert function? > > Static assert is evaluated at compile-time. It can be useful to validate template parameters and such. I also use it for checking versions, i.e. version(VersionOne) { } else version(VersionTwo) { } else { // There must be either VersionOne or VersionTwo defined // Fail if there isn't static assert(0); } |
Copyright © 1999-2021 by the D Language Foundation