Re: Seperate template instantiations for integer parameter
You should test these things yourself rather than posting to a
newsgroup --
you'll learn more.
Matthias Hofmann posted:
You will learn more about your compiler, but not about C++.
Frederick Gotham wrote:
If we can't rely on our compiler, then why write code at all?
Seungbeom Kim wrote:
Because we expect our compilers to be consistent with the standard
in most cases, even though not all of them are perfect in all cases.
If you know something should be okay according to the standard but
your compiler doesn't accept it, you can seek for another better one.
If anything, it would be good to run the test first, and then post the
results here and ask if they're correct.
Yes, testing something with a compiler might reveal something about the
language, but you can never be sure whether it's *defined* that way
by the language (and thus expected to work the same way on other
compilers too) or it just happens to be that way on your compiler,
until it's confirmed by the standard.
That's good advice for advanced- or expert-level programmers.
For beginner- or intermediate-level programmers who discover a
compiler bug, my advice is to make three assumptions:
1. First, assume the compiler is right and your code is wrong. Try
to find out where you made your mistake.
2. Second, compilers are themselves programs, and they have bugs.
But if you think you found a situation where the compiler
really did make a mistake... look up the relevant passage in the
standard and ask for advice interpreting it, because you're still
probably wrong.
3. Third, if you're really certain that this is a compiler bug... make
a
minimal program that demonstrates the problem, and post it along
with the relevant passage from the standard on a group such as
comp.lang.c++.moderated, asking for advice. Do this BEFORE you
report a bug to the compiler maker.
The reason is... yes, compilers do have bugs, but 99% of the time,
when a programmer tells me that he's found one, he hasn't.
I'm not a hypocrite... even though I don't consider myself a beginner
or
intermediate, on those occasions where I think that I found a bug, I go
through the same three steps. In my whole 28-year career, I've
only found 3 compiler bugs that hadn't already been documented...
in ALL of the other cases, it turned out that I was doing something
that I shouldn't have. I suspect my case is typical.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]