Post by VipinI have no clue why this should become a big hype. I will agree to your
remarks from a standard c/c++ perspective.
Your thread tries not to address the OP's topic(yes or no)
The OP had been pointed in the correct direction and appeared to have gotten
it to work. It would have not served any purpose to answer the question
again. I merely wanted to point out that "technically" your answer was
incorrect if you were writing C or C++ and to point anyone who was curious
as to why, in the proper direction.
Post by Vipinand says the program is
invalid. Isn't this a vc++ newsgroup? I never say, the code I provide here
is going to build on other environments.All I use is the Microsoft VC++
compiler.
The point that I made earlier is that the code that you have written is not
guaranteed to compile even on a newer version of the Microsoft compiler
because it does not conform to the standard. A simple code change is all
that is required and you're good to go. Why would you continue to resist
it? What purpose does it serve?
Post by VipinIf you go buy c++ Primer from Stanley Lippman( whom I assume is an
architect on vc++ team )
I believe he is involved if my MSDN magazines are correct!
Post by VipinThere are several dozens of places where his code shows up as
int main()
{
....
}
There isn't a return statement being called, may be he has an errata now
in place somewhere, I don't know.
The code is correct if it is C++. In the C++ standard it is stated that
there is an "implicit" return value of 0 if one is not explicitly written.
So, as written, the code is correct if it is C++. This information was
contained in the second link that I gave you.
Post by VipinDoes that make him an ignorant person to you?
No. His code is accurate and he is far more articulate and knowlegable
about the standards than I am.
Post by VipinFor me he is a C++ God.
Then perhaps you would consider emulating him! ;)
Post by VipinI considering programming methodologies more important than mugging up
all of syntax of a langauage and specifics of each standard.
There lies the rub. There are many places to trip you up in languages like
C and C++. If you are not aware of the places that have tripped others up
before you, you are destined to make the same mistakes. There are times
when order of evaluation, sequence points and other such minutae of the
language make a huge difference. It is best to learn these things before
you write the bug that takes a week to find!
It doesn't necessarily mean that you have to become a language lawyer, but
it does mean that you need to pay attention to the details of the language.
Post by VipinIf you are that smart, tell me what this the below expression would
evaluate to without running it in a program.
"Hello"[1] == ??? ( again if you are man, you should say rightaway
before you compile/run and ask the compiler
to give you the answer)
I don't claim to be perfect, but given that your example is malformed and
won't compile as given anyway, I can only guess at what you are looking for
since given the code, what you *really* get is a compiler error due to the
invalid trigraph sequence and lack of semi-colon.
Let's see though, we have a narrow string literal which means that we have a
type of "6 element array of const char" and static storage duration. You
are referencing the second array element at position [1] with a value that
represents 'e'. You are comparing it with something, but the rest of the
line is invalid as the compiler would surely tell you.
-Pete