Ann: lesson 3 "The standard main arguments are ungood for seriousWindows programming"

A

Alf P. Steinbach

<url:
http://learnwinapi.wordpress.com/2011/12/20/lesson-3-the-textual-process-arguments/>


One reaction to this posting was that it must surely be irrelevant to
Windows GUI programming. Command line, main arguments? Hey?

Well that's where it all starts, e.g. when you double-click a file to
just "open" it: the program receives the file name via the command line.

And one interesting fact is that the C++ standard 'main' signature is
utterly useless for reliably transferring such file names in Windows.


Cheers, & enjoy!,

- Alf
 
A

Alf P. Steinbach

'using namespace std;' at namespace scope is a bit rubbish.

Perhaps you are confusing small program files, with header files.

Or perhaps you have no understanding of what you're talking about.

Anyway, it's rubbish.

Your pathological insistence on avoiding std::size_t makes you look like
a mentalist.

This sounds rabid.

You forgot to mention 'wmain'

No, I have not discussed the Microsoft startup functions in general, and
not at all in this posting. There are 4 of them, by the way. The one you
forgot trying make it seem I forgot, is called 'wWinMain'.

which might be because it is non-standard
however you are putting other non-standard Microsoft crap in your main
function anyway so it makes little difference.

I count three fallacies there.

Get some sleep, or whatever it is you need.


Cheers & hth.,

- Alf
 
J

Juha Nieminen

Leigh Johnston said:
You are a perfect specimen of the troll that can't accept criticism.

Why is the word "troll" so much misused? Just because someone disagrees
with you doesn't make him a "troll". "Troll" does not mean "has a
different opinion than me".

I think you are using the word as an insult. Now *that* starts bordering
the trolling territory.
 
G

gwowen

  Why is the word "troll" so much misused? Just because someone disagrees
with you doesn't make him a "troll". "Troll" does not mean "has a
different opinion than me".

Funnily enough, since "troll" always used to mean "someone who takes
pleasure in gratuitously starting / continuing / participating in
flamewars and other unproductive arguments", there's precisely one
persistent troll in this thread.

And its not you or Alf.

I'll let you decide whether it me or Leigh.
 
R

Richard

[Please do not mail me a copy of your followup]

"Alf P. Steinbach" <[email protected]> spake the secret code
Get some sleep, or whatever it is you need.

It seems he needs a life in order to find some pleasure in his existence
that isn't predicated on being a net.cop for comp.lang.c++.
 
R

Richard

[Please do not mail me a copy of your followup]

Leigh Johnston <[email protected]> spake the secret code
[more useless drivel]

Welcome to my KILL file. Had you posted the occasional useful tidbit
instead of just self-appointing yourself moderator for this
unmoderated newsgroup and doing anything other than just arguing with
other users and bitching about what's posted here, I might not have
been tempted to KILL file you.

However, I can't recall you starting a single useful discussion and
lately all I've seen from you is bitching about other people and being
a total tight-ass about the "rules".

Have a nice life. I know mine will be more enjoyable for having
removed your output from it.
 
G

Geoff

<url:
http://learnwinapi.wordpress.com/2011/12/20/lesson-3-the-textual-process-arguments/>


One reaction to this posting was that it must surely be irrelevant to
Windows GUI programming. Command line, main arguments? Hey?

Well that's where it all starts, e.g. when you double-click a file to
just "open" it: the program receives the file name via the command line.

And one interesting fact is that the C++ standard 'main' signature is
utterly useless for reliably transferring such file names in Windows.

I guess I am missing the point.

MSVC++2010 is not current with respect to the C++ standard, this is
not news. Microsoft recommends GUI apps that accept CLAs receive them
via their API. They make no effort to accommodate "portable" C++ code
in their GUI applications, but then, neither does Apple. They both
behave in a "portable" way if you write non-GUI application code, so
where's the beef?
 
A

Alf P. Steinbach

I guess I am missing the point.

MSVC++2010 is not current with respect to the C++ standard, this is
not news. Microsoft recommends GUI apps that accept CLAs receive them
via their API. They make no effort to accommodate "portable" C++ code
in their GUI applications, but then, neither does Apple. They both
behave in a "portable" way if you write non-GUI application code, so
where's the beef?

Oh. Windows console apps have the exact same problem. It does not have
to do with how current Visual C++ is wrt. to the C++ standard: it is a
problem for *all* Windows C++ compilers, since it is a
Windows-versus-C++ problem, not a Visual-C++-versus-standards problem.

Historically it started roughly in 1985, when Microsoft used their
Windows ANSI Western single byte encoding as "standard" for Windows 1.0.

Microsoft realized that that wouldn't do and so they were main movers in
the original Unicode development. But they made a wrong move, when about
1993 (IIRC) they introduced Windows NT with original 16-bit Unicode text
encoding. Instead of char-oriented encoding such as UTF-8.

Then in 1998 C++ was standardized, with char based main arguments, and
the standard hinting stronly that those should be "MBCS" (multi-byte
character set) strings, like UTF-8. Which can represent any text. While
in Windows they're ANSI, which can only represent text in some locale.

Shortly after, from 2002 onwards and about a five year period, but I am
not sure of cause and effect, the Linux world moved to UTF-8. But
Microsoft did not. So one can say, in a way, that the Linux world took
up the challenge of C88 and C++98 `main` and *made it work* for the
modern world, while Microsoft did not take up that challenge.

It is, IMHO opinion, an interesting case of standardizing existing
practice (the old 'main' signatures) only where that practice had
already ceased to be useful. And inventing stuff for the rest of the
standard. Which is not exactly how standardization is meant to work
ideally: it "should" just describe existing practice that works.

Cheers & hth.,

- Alf
 

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,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top