Amusing Microsoft C++ ad

B

Bob Nelson

The November 2003 edition of the ``C/C++ Users Journal'' contains a
multi-paged advertising section for Microsoft's Visual C++. NET 2003
product.

One section focuses on the compiler as being one of the most ISO compliant
on any platform. Overall, the ad is rather interesting and has some
worthwhile code snippets.

- The amusing part is the declaration of ``main'' in an example showing
support for function template specialization:

void main()
 
D

David B. Held

Bob Nelson said:
[...]
- The amusing part is the declaration of ``main'' in an example
showing support for function template specialization:

void main()

Yet further proof that "void main()" is legal C++ because
Microsoft says so! The Sage has had the last laugh on
us all!!!

Dave
 
H

Herb Sutter

The November 2003 edition of the ``C/C++ Users Journal'' contains a
multi-paged advertising section for Microsoft's Visual C++. NET 2003
product.

One section focuses on the compiler as being one of the most ISO compliant
on any platform. Overall, the ad is rather interesting and has some
worthwhile code snippets.

- The amusing part is the declaration of ``main'' in an example showing
support for function template specialization:

void main()

I thought that was amusing too. :)

FYI, since VC++ 7.0, under /Za you get the following for such code:

warning C4326: return type of 'main' should be 'int' instead of 'void'

And everyone should use /Za by default now. In VC++ 7.x the documentation
writers also did a sweep through all the docs to get rid of "void main()".
Maybe some escaped (it's always possible to miss a few), but I hope that
it has already disappeared from the docs.

Herb

---
Herb Sutter (www.gotw.ca)

Convener, ISO WG21 (C++ standards committee) (www.gotw.ca/iso)
Contributing editor, C/C++ Users Journal (www.gotw.ca/cuj)
Visual C++ architect, Microsoft (www.gotw.ca/microsoft)
 
A

Alf P. Steinbach

I thought that was amusing too. :)

FYI, since VC++ 7.0, under /Za you get the following for such code:

warning C4326: return type of 'main' should be 'int' instead of 'void'

And everyone should use /Za by default now.

Considering that VC is mostly used for Windows programming, and that VC
with option /Za chokes on non-standard constructs in the main Windows API
header files (such as anonymous unions), are you really sure?

In VC++ 7.x the documentation
writers also did a sweep through all the docs to get rid of "void main()".
Maybe some escaped (it's always possible to miss a few), but I hope that
it has already disappeared from the docs.

T'would be nice if they could get the defaults right wrt. to that non-standard
beast "WinMain" also. When the GNU folks could, why not Microsoft? Okay, this
is off-topic, but then, it's one of the most used C++ compilers.
 
B

Bob Bell

David B. Held said:
Bob Nelson said:
[...]
- The amusing part is the declaration of ``main'' in an example
showing support for function template specialization:

void main()

Yet further proof that "void main()" is legal C++ because
Microsoft says so! The Sage has had the last laugh on
us all!!!

And not just any part of Microsoft, either. The marketing department says so.

Well, if that's good enough for The Sage it's good enough for me.

Bob
 
W

WW

Bob said:
And not just any part of Microsoft, either. The marketing department
says so.

Well, if that's good enough for The Sage it's good enough for me.

He would be *very* good in marketing. All you should ensure is that he
works for the competitor. ;-)
 
G

galathaea

:
: >The November 2003 edition of the ``C/C++ Users Journal'' contains a
: >multi-paged advertising section for Microsoft's Visual C++. NET 2003
: >product.
: >
: >One section focuses on the compiler as being one of the most ISO
compliant
: >on any platform. Overall, the ad is rather interesting and has some
: >worthwhile code snippets.
: >
: >- The amusing part is the declaration of ``main'' in an example showing
: > support for function template specialization:
: >
: > void main()
:
: I thought that was amusing too. :)
:
: FYI, since VC++ 7.0, under /Za you get the following for such code:
:
: warning C4326: return type of 'main' should be 'int' instead of 'void'
:
: And everyone should use /Za by default now. In VC++ 7.x the documentation
: writers also did a sweep through all the docs to get rid of "void main()".
: Maybe some escaped (it's always possible to miss a few), but I hope that
: it has already disappeared from the docs.

In 7.0 there are certainly quite a lot of MSDN help pages / docs/ etc. that
still have the void main(). In fact, there are some docs that have both int
main() and void main() on the same page!
 
D

David B. Held

galathaea said:
[...]
In fact, there are some docs that have both int
main() and void main() on the same page!

Yet further proof that if the implementation allows "int main()",
then "void main()" is also legal! Will wonders never cease??

Dave
 
G

Guest

Hello Bob Nelson,

- The amusing part is the declaration of ``main'' in an example showing
support for function template specialization:

void main()

I really don't understand how Microsoft managed to make the worlds most
powerful and easy to use OS's.
 
P

Phlip

- The amusing part is the declaration of ``main'' in an example showing
I really don't understand how Microsoft managed to make the worlds most
powerful and easy to use OS's.

By letting others do their research for them, then skimming off what worked
and re-engineering it.

For example, everyone else's standard is "int main". So MS's standard is
"void main" - it's non-standard, a little "better", and addresses a known
market.
 
W

WW

Phlip said:
For example, everyone else's standard is "int main". So MS's standard
is "void main" - it's non-standard, a little "better", and addresses
a known market.

It is not MS standard. It is backwards compatibility to their old
compilers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top