ambiguous operator on Visual Studio 2010

A

Alf P. Steinbach /Usenet

* Öö Tiib, on 10.06.2011 10:58:
Yes, i may want it to be there (popping up can be avoided by hiding
it),
Ah.


because without console the cin, cerr and cout go to god knows
where in Windows.

Well, in addition to God, you might ask me. :) By default they go nowhere. But
they can be redirected, by the ordinary redirection operators.

Actually I have seen (portable to Linux and Mac)
code that has gone full round:

int main( int argc, char *argv[] ) {
Configuration::Load( argc, argv );
#if defined(_MSC_VER)
BOOL ok = ::AllocConsole();

"If the compiler is MSVC, allocate a console window". Hm. You better inform
those folks that they're doing meaningless things.

// ... mess with screen buffers of console
// ... redirect std streams to console
#endif
return Session::run( argc, argv );
}

"Full round" in sense that they had /subsystem:windows and they had
int main() and now what was missing was console.

That's my preference. An ordinary GUI subsystem app, with a standard `main`. Why
write more to get non-standard code? That's just silly. It's like writing `void
main`, one character more, just to get a non-standard idiot's[1] version.

Also the solution to
their issue was not as stupid as it feels. It sort of supports your
point, sort of argues with it and sort of misses it too. ;) The real
reasons behind the mess are in Windows architecture, the MS compiler
team feels to consist of decent specialists.

There's no mess wrt. this in the Windows architecture.

To wit, the MinGW g++ compiler / toolchain does not have this problem.

Technical: `main` and `wMain` and `winMain` and `wWinMain` are not supported at
the Windows API level (disregarding the MSVC runtime as part of the API).


Cheers & hth.,

- Alf

Notes:
[1] When I'm writing "idiot's" that's just an exaggeration to put it to a point.
For example, Bjarne used that `void main` at least once in the second edition of
The C++ Programming Language, and I'm not calling him an idiot. :)
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top