From: Jason Shirk (jasonsh_at_[hidden])
Date: 2002-02-17 02:22:51
I'm not sure it's possible, but a nice addition to Boost would be the
ability to determine if an expression is a constant integer or not.
Everything I've thought of would cause an error if the expression were
not a constant.
I can imagine a couple of uses for this, but the immediate need is to
not allow the following to compile:
strncpy(buf, "this will overrun", 512); // oops, 512 >
Here, the compiler can deduce the array bounds. If the count expression
is constant, then it's simple to cause a compile time error. If it's
not, then no error should happen.
Of course tools such as the compiler can be taught to catch this, but a
pure language implementation would be really cool.
VC++ Compiler Team
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk