Re: C++0x - a quick and dirty introduction (as of November 2007)
On Dec 16, 5:37 am, Walter Bright <wal...@digitalmars-nospamm.com>
wrote:
James Kanze wrote:
I'm not arguing against making more things available as compile
time constants. I'm just saying that the programmer should be
able to express his intent, to avoid thing accidentally getting
used as compile time constants when he doesn't want to guarantee
that as part of the contract.
I understand your point, but since a compile time error is issued if
anything goes wrong, I don't see a big issue.
No it's not. If my function happens "accidentally" (i.e. I
don't want to guarantee it to be a constant as part of the
interface) to be a compile time constant, and someone uses it as
a constant, there will be no compile time error. If I later
change the function, and it ceases to be a compile time
constant, I've broken user code.
Admittedly, the code was actually broken before, since the user
used the function in a way that was not documented to work. But
as a vendor, I don't like breaking user code, even if the user
was wrong. Proving users to be stupid is NOT the best
commercial policy I can think of.
And no, it's not a "big" issue. It's probably not worth adding
a keyword to D, for example, to handle it. But since we're
talking about what C++ should or should not accept, and the new
keyword is already part of the proposal, it would seem a shame
not to use it.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient?e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S?mard, 78210 St.-Cyr-l'?cole, France, +33 (0)1 30 23 00 34
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]