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

Discussion in 'C++' started by Alf P. Steinbach, Dec 20, 2011.

  1. <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
     
    Alf P. Steinbach, Dec 20, 2011
    #1
    1. Advertising

  2. On 20.12.2011 13:00, Leigh Johnston wrote:
    > On 20/12/2011 09:44, Alf P. Steinbach wrote:
    >> <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.

    >
    > '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
     
    Alf P. Steinbach, Dec 20, 2011
    #2
    1. Advertising

  3. Re: Ann: lesson 3 "The standard main arguments are ungood for serious Windows programming"

    Leigh Johnston <> wrote:
    > 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.
     
    Juha Nieminen, Dec 20, 2011
    #3
  4. Alf P. Steinbach

    gwowen Guest

    On Dec 20, 2:00 pm, Juha Nieminen <> wrote:
    > Leigh Johnston <> wrote:
    > > 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".


    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.
     
    gwowen, Dec 20, 2011
    #4
  5. Alf P. Steinbach

    Richard Guest

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

    "Alf P. Steinbach" <> spake the secret code
    <jcq0r1$3jl$> thusly:

    >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++.
    --
    "The Direct3D Graphics Pipeline" -- DirectX 9 version available for download
    <http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

    Legalize Adulthood! <http://legalizeadulthood.wordpress.com>
     
    Richard, Dec 20, 2011
    #5
  6. Alf P. Steinbach

    Richard Guest

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

    Leigh Johnston <> spake the secret code
    <> thusly:

    >[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.
    --
    "The Direct3D Graphics Pipeline" -- DirectX 9 version available for download
    <http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

    Legalize Adulthood! <http://legalizeadulthood.wordpress.com>
     
    Richard, Dec 20, 2011
    #6
  7. Alf P. Steinbach

    Geoff Guest

    Re: Ann: lesson 3 "The standard main arguments are ungood for serious Windows programming"

    On Tue, 20 Dec 2011 10:44:06 +0100, "Alf P. Steinbach"
    <> wrote:

    ><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?
     
    Geoff, Dec 20, 2011
    #7
  8. On 20.12.2011 20:03, Geoff wrote:
    > On Tue, 20 Dec 2011 10:44:06 +0100, "Alf P. Steinbach"
    > <> wrote:
    >
    >> <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?


    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
     
    Alf P. Steinbach, Dec 20, 2011
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dave reno

    interesting table lesson

    dave reno, Nov 26, 2003, in forum: HTML
    Replies:
    2
    Views:
    394
    informant
    Nov 26, 2003
  2. Edward
    Replies:
    2
    Views:
    1,777
    Edward
    Sep 7, 2005
  3. Juan R.
    Replies:
    3
    Views:
    632
    Joe Kesselman
    May 6, 2006
  4. Alf P. Steinbach
    Replies:
    7
    Views:
    403
    Alf P. Steinbach
    Jan 4, 2012
  5. Alf P. Steinbach
    Replies:
    0
    Views:
    229
    Alf P. Steinbach
    Jan 8, 2012
Loading...

Share This Page