From: Vipin on
you are a psycho. You simply won't listen and above that you say that I am
not worth being MVP,
what is wrong in the answers I post.

Go read this which clearly states that main can return void.

I don't care with a DJGPP compiler's documentation

This is a Microsoft Newsgroup and read Microsoft documentation if you
consider my posts are worthless.

http://msdn.microsoft.com./library/default.asp?url=/library/en-us/vclang98/HTML/_pluslang_program_startup.3a_.the_main_function.asp


--
Vipin Aravind
Microsoft - MVP

"Pete Delgado" <Peter.Delgado(a)noads.net> wrote in message
news:uyLbkiFHGHA.2040(a)TK2MSFTNGP14.phx.gbl...
>
> "Vipin" <Vipin(a)nospam.com> wrote in message
> news:eGZdYu6GGHA.312(a)TK2MSFTNGP09.phx.gbl...
>> What is the problem with this signature?
>
> Did you read the links I provided? It is not valid C or C++. The
> compiler and runtime are free to do *anything* they want with this. From
> crashing your program to launching nuclear missiles.
>
>> I have been programming in c/c++ exclusively for past 7 years
>> and this is not my first program, OK.
>
> Then you have been making the same mistake for 7 years. You should be
> improving.
>
>> Go create a c/c++ file, compile and see.
>
> Just because something compiles and links does not make it a correct
> program. This issue is addressed in the first link that I gave to you.
>
> The funny thing is that you are repeating the same argument that most
> novice programmers. The sad part is that you are an Microsoft MVP and are
> just as wrong and you are teaching new programmers incorrect information.
>
> I suppose one could make the case that you never plan to use another
> compiler or another platform, however, if you disable language extensions
> on the VS 2005 compiler, you will indeed get the proper warning.
>
> C4326: return type of 'main' should be 'int' instead of 'void'
>
> So I guess that means that you can't change the default compiler settings
> either if you plan to continue to use the non-standard contruct.
>
>>I don't care whatever links
>> you give me.
>
> That's obvious judging from your general attitude.
>
>>
>> void main()
>> {
>> }
>
> Isn't now, and never was standard C or C++...
>
> -Pete
>
>


From: Pete Delgado on

"Vipin" <Vipin(a)nospam.com> wrote in message
news:%23tff$sGHGHA.1452(a)TK2MSFTNGP11.phx.gbl...
> you are a psycho.

That you for resorting to personal insults. That's always helpful.

>You simply won't listen and above that you say that I am not worth being
>MVP,

I did not say that you were not worth being an MVP. I did say that in
*this* particular case you are just as wrong as a novice programmer and that
the fact that you are an MVP makes it worse because others will emulate your
code due to your status as an MVP.

As far as not listening, I have read your posts and I don't believe that I
have misrepresented anything. We simply have a disagreement on the facts.

> what is wrong in the answers I post.

I have already answered that question several times. Technically you are
incorrect if you purport to be programming in standard C or C++. Certainly
Microsoft has extended the language and allows void main() in particular
versions of the compiler, but it is not standard C or C++ -just as the links
I cited state. This means that your programs are not guaranteed to compile
or run correctly on *any* other compiler -even the newer ones from
Microsoft. I have already shown you that VS 2005 will flag the code with a
warning if you try to compile it.

>
> Go read this which clearly states that main can return void.

For the implementation of the Visual C++ 6.0 compiler the Microsoft
extensions allow it, but it is still not standard C or C++. I think that
you are confusing what the compiler will allow with standard C or C++.

BTW: That is why Microsoft has a topic entitled "Breaking Changes" for each
version of the compiler. As the compiler becomes more standards complient,
things like void main() no longer are allowed and will not compile.

> I don't care with a DJGPP compiler's documentation

The DJGPP compiler documentation comments on standard C. Not just the
compiler's implementation of the standard. Since I don't have a link to the
ANSI/ISO C standards that I could point to, I used the next best thing. I'm
sure that if you had the standards documents you would find similar wording.

> This is a Microsoft Newsgroup and read Microsoft documentation if you
> http://msdn.microsoft.com./library/default.asp?url=/library/en-us/vclang98/HTML/_pluslang_program_startup.3a_.the_main_function.asp

Again, this refers to a Microsoft extension to the language. What I am
commenting on is standard C and C++ which is independant of any compiler. I
simply was pointing out that void main() is not standard C or C++. You seem
to want to make the argument that it is, which is dead wrong.

There are many cases where you may want to write a portable library using
Visual Studio and the Microsoft C++ compiler, why put yourself at a
disadvantage and target the Microsoft flavor of C++ and not portable,
standards complient C++?

> consider my posts are worthless.

I never said that I consider your posts worthless. Since you obviously
spend a great deal of time answering questions in the newsgroup and for the
most part give fairly good information it would be silly for me to assert
such a thing. I don't know how you got that impression from my posts. I am
simply saying that you are mistaken on *this* particular point.


-Pete


From: Vipin on

I 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) and 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.

If you go buy c++ Primer from Stanley Lippman( whom I assume is an architect
on vc++ team )
There 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.
Does that make him an ignorant person to you?

For me he is a C++ God. I considering programming methodologies more
important than mugging up
all of syntax of a langauage and specifics of each standard.

If 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)

--
Vipin Aravind
Microsoft - MVP


"Pete Delgado" <Peter.Delgado(a)noads.net> wrote in message
news:%23bsbhUHHGHA.2472(a)TK2MSFTNGP10.phx.gbl...
>
> "Vipin" <Vipin(a)nospam.com> wrote in message
> news:%23tff$sGHGHA.1452(a)TK2MSFTNGP11.phx.gbl...
>> you are a psycho.
>
> That you for resorting to personal insults. That's always helpful.
>
>>You simply won't listen and above that you say that I am not worth being
>>MVP,
>
> I did not say that you were not worth being an MVP. I did say that in
> *this* particular case you are just as wrong as a novice programmer and
> that the fact that you are an MVP makes it worse because others will
> emulate your code due to your status as an MVP.
>
> As far as not listening, I have read your posts and I don't believe that I
> have misrepresented anything. We simply have a disagreement on the facts.
>
>> what is wrong in the answers I post.
>
> I have already answered that question several times. Technically you are
> incorrect if you purport to be programming in standard C or C++.
> Certainly Microsoft has extended the language and allows void main() in
> particular versions of the compiler, but it is not standard C or C++ -just
> as the links I cited state. This means that your programs are not
> guaranteed to compile or run correctly on *any* other compiler -even the
> newer ones from Microsoft. I have already shown you that VS 2005 will
> flag the code with a warning if you try to compile it.
>
>>
>> Go read this which clearly states that main can return void.
>
> For the implementation of the Visual C++ 6.0 compiler the Microsoft
> extensions allow it, but it is still not standard C or C++. I think that
> you are confusing what the compiler will allow with standard C or C++.
>
> BTW: That is why Microsoft has a topic entitled "Breaking Changes" for
> each version of the compiler. As the compiler becomes more standards
> complient, things like void main() no longer are allowed and will not
> compile.
>
>> I don't care with a DJGPP compiler's documentation
>
> The DJGPP compiler documentation comments on standard C. Not just the
> compiler's implementation of the standard. Since I don't have a link to
> the ANSI/ISO C standards that I could point to, I used the next best
> thing. I'm sure that if you had the standards documents you would find
> similar wording.
>
>> This is a Microsoft Newsgroup and read Microsoft documentation if you
>> http://msdn.microsoft.com./library/default.asp?url=/library/en-us/vclang98/HTML/_pluslang_program_startup.3a_.the_main_function.asp
>
> Again, this refers to a Microsoft extension to the language. What I am
> commenting on is standard C and C++ which is independant of any compiler.
> I simply was pointing out that void main() is not standard C or C++. You
> seem to want to make the argument that it is, which is dead wrong.
>
> There are many cases where you may want to write a portable library using
> Visual Studio and the Microsoft C++ compiler, why put yourself at a
> disadvantage and target the Microsoft flavor of C++ and not portable,
> standards complient C++?
>
>> consider my posts are worthless.
>
> I never said that I consider your posts worthless. Since you obviously
> spend a great deal of time answering questions in the newsgroup and for
> the most part give fairly good information it would be silly for me to
> assert such a thing. I don't know how you got that impression from my
> posts. I am simply saying that you are mistaken on *this* particular
> point.
>
>
> -Pete
>


From: Pete Delgado on

"Vipin" <Vipin(a)nospam.com> wrote in message
news:u7BYJhHHGHA.2460(a)TK2MSFTNGP10.phx.gbl...
>
> I 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.

>and 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?

>
> If 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!

> There 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.

> Does 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.

> For me he is a C++ God.

Then perhaps you would consider emulating him! ;)

>I 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.

>
> If 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


From: Vipin on
Now you are saying Microsoft c++ compiler has issues.

This is the warning I get for:-
int main()
{
}
main.cpp
main.cpp(6) : warning C4508: 'main' : function should return a value; 'void'
ret
urn type assumed
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.


Now what is your logic, Is it language extenstions?

I just posed what this expression would evaluate to "Hello"[1].

But you are really strange, you are expecting me to type in a semicolon
here.
Come on, I won't be able to write a single program without knowing about
semicolons in c/c++,
and I think you may be even thinking that is the case. Anyway I have no need
to do any convincing.

--
Vipin Aravind
Microsoft - MVP

"Pete Delgado" <Peter.Delgado(a)noads.net> wrote in message
news:%23piwdCIHGHA.1132(a)TK2MSFTNGP10.phx.gbl...
>
> "Vipin" <Vipin(a)nospam.com> wrote in message
> news:u7BYJhHHGHA.2460(a)TK2MSFTNGP10.phx.gbl...
>>
>> I 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.
>
>>and 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?
>
>>
>> If 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!
>
>> There 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.
>
>> Does 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.
>
>> For me he is a C++ God.
>
> Then perhaps you would consider emulating him! ;)
>
>>I 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.
>
>>
>> If 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
>
>