Thread overview
Static Assert?
Aug 10, 2005
Jerry
Aug 10, 2005
Sean Kelly
August 10, 2005
What's the difference between static assert and the normal assert function?

-J


August 10, 2005
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
"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);
}