Topic: [Fwd: [Fwd: More M$ Not Conforming points...]]


Author: James Kuyper <kuyper@wizard.net>
Date: 1999/09/09
Raw View
Bill Seymour wrote:
...
> I can write a C or C++ program with a proper int main(int, char**)
> and compile it with MSVC++ just fine.  It wouldn't be a Windows(R)
> program, of course; but the standard doesn't speak to that.

I tried to carefully specify that I was only referring to compilation of
programs that use Windows, but you caught one of the places where I
didn't include that qualification. For DOS programs, MSVC++ qualifies as
a hosted non-implementation of standard C++.
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: "Michael VanLoon" <michaelv@edifecs.com>
Date: 1999/09/09
Raw View
James Kuyper <kuyper@wizard.net> wrote in message
news:37D7EF63.53F1117D@wizard.net...
> Bill Seymour wrote:
> ...
> > I can write a C or C++ program with a proper int main(int, char**)
> > and compile it with MSVC++ just fine.  It wouldn't be a Windows(R)
> > program, of course; but the standard doesn't speak to that.
>
> I tried to carefully specify that I was only referring to compilation of
> programs that use Windows, but you caught one of the places where I
> didn't include that qualification. For DOS programs, MSVC++ qualifies as
> a hosted non-implementation of standard C++.

It's not "DOS programs".  It's any program that doesn't use the MFC
library AFAIK.  Some of the most powerful "programs" on NT have a proper
main(), such as many of the BackOffice services.  An example being some
of the Exchange Server gateways.  These are long-running multi-threaded
servers, yet have a main(), because they don't have "Windows".  Sure
they are Win32 based, but they don't use MFC, because they have no UI
(the UI is an separate RPC-based admin application).

The point is, I think you're generalizing way too much.  MFC is an
application framework which usurps main() for its purposes.  Windows
programming in general, and development with MSVC in particular, does
not require you to give up main().




[ 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://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Ron Natalie <ron@sensor.com>
Date: 1999/09/09
Raw View


James Kuyper wrote:

> I tried to carefully specify that I was only referring to compilation of
> programs that use Windows, but you caught one of the places where I
> didn't include that qualification. For DOS programs, MSVC++ qualifies as
> a hosted non-implementation of standard C++.

MSVC++ hasn't been able to compile a DOS program in several major
versions.



[ 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://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: jcoffin@taeus.com (Jerry Coffin)
Date: 1999/09/09
Raw View
In article <37D7EF63.53F1117D@wizard.net>, kuyper@wizard.net says...
> Bill Seymour wrote:
> ...
> > I can write a C or C++ program with a proper int main(int, char**)
> > and compile it with MSVC++ just fine.  It wouldn't be a Windows(R)
> > program, of course; but the standard doesn't speak to that.
>
> I tried to carefully specify that I was only referring to compilation of
> programs that use Windows, but you caught one of the places where I
> didn't include that qualification. For DOS programs, MSVC++ qualifies as
> a hosted non-implementation of standard C++.

I'm a bit lost as to what you're saying here, but perhaps it's best to
ignore that, and simply point out exactly how things are, since I'm
pretty sure that 1) you're not saying exactly what you want to, and 2)
most of both what you're saying, and what you intended to say are
wrong anyway.

1) MS C can use an entry point named main() for console (NOT DOS)
programs.
2) most people who write windowed programs use an entry point named
WinMain.
3) MS C can use an entry point named main() for windowed programs.
4) if you use an entry point named main() for a windowed program, you
also have to specify "-subsystem:windows" to the linker.
5) If you use an entry point named WinMain for a windowed program, the
linker will deduce that it's a windowed program by itself.
6) A windowed program isn't anything like "strictly conforming" (as
defined in the C standard) regardless of WHAT name it uses for its
entry point.
7) Point 6 remains true almost regardless of the windowing system you
choose to use.

In short, this is a LONG thread on a subject that really deserved far
less.  There's little question that any windowed program (whether for
the Mac, Amiga, Windows, X, SunView, NeWS, or whatever) is portable
only to those systems on which that windowing system has been
implemented.  There's little doubt in my mind that at least for the X
and Windows APIs, the groups of machines upon which implementations
are available, is quite similar, while the other systems are
considerably more restrictive as a rule.  I think it's fair to say
that using the Windows API on most commercial versions of UNIX is a
fairly expensive proposition; a similar situation exists with using
the X API on Windows -- in both cases, it's possible, but not a
widespread practice, and generally expensive (at the VERY least in
terms of time, and usually in direct expense as well).

In short, the use of "WinMain" vs. "main" as the entry point in a
Windows program has darned little to do with much of anything.  It has
virtually no effect on portability either in theory or in practice.
It has virtually nothing to do with whether any particular compiler
conforms with the C++ standard.  Just for example, IIRC, if you use
Borland's C++ Builder instead of MS VC++, it's (at best) more
difficult to use a name other than WinMain for the entry point to a
windowed program, but as a whole I'd say the compiler is substantially
closer to conforming than VC++ anyway.

--
    Later,
    Jerry.

The Universe is a figment of its own imagination.


[ 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://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Bill Seymour <bsey@pobox.com>
Date: 1999/09/09
Raw View
"James Kuyper Jr." wrote:
>
> Jeff Rife wrote:
> ....
> > In 3.6.1/1 [basic.start.main] of the C++ standard, we have:
> >
> > "A program shall contain a global function called main, which
> > is the designated start of the program."
>
> That doesn't apply in a freestanding implementation. Of course,
> MSVC++ isn't conforming, and doesn't try to be, but if they ever
> did decide to try, it would be as a freestanding implementation.
> Such situations are precisely what the concept of freestanding
> implementations was invented for.
>

My understanding is that the concept of freestanding implementations
was invented for embedded systems that don't run programs under an
operating system, and so can't be expected to do file I/O, etc.
IMO, MSVC++ is simply non-conforming, and so the concepts of
hosted and freestanding implementations are irrelevant.

OTOH, I don't think that the main() issue is a fair criticism.
I can write a C or C++ program with a proper int main(int, char**)
and compile it with MSVC++ just fine.  It wouldn't be a Windows(R)
program, of course; but the standard doesn't speak to that.

--Bill Seymour


[ 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://reality.sgi.com/austern_mti/std-c++/faq.html              ]