The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: random832@fastmail.us (Random832)
Subject: [TUHS] why the leading under score added to function names?
Date: Sat, 25 Feb 2012 17:15:32 -0500	[thread overview]
Message-ID: <4F495D84.8030206@fastmail.us> (raw)
In-Reply-To: <20120225203959.GE29866@mercury.ccil.org>

I'm going to need to train myself to use the "reply to list" button. 
Though in this case I think part of the problem was duplicate-filtering 
which lost the copy that had the appropriate header.

On 2/25/2012 3:39 PM, John Cowan wrote:
>  Random832 scripsit:
>
>>  For instance, this is, according to Raymond Chen, why they added
>>  WinMain rather than extending main (they didn't know if extensions to
>>  main would be allowed).
>  That doesn't sound very reasonable to me.  When you link a Windows
>  program, it still has a main() procedure provided by Windows which does
>  setup and then invokes WinMain().

This is not true in my experience. If it was ever true, it's not true
today (with MSVC, anyway. GCC may be different, but if there is a
'system-provided main()' it's GCC, or cygwin or mingw, and not anything
from microsoft, that is providing it). The procedure "provided by
windows" (provided by MSVC, actually) that does that is in fact called
WinMainCRTStartup. When you link a windows _console_ program, a
different function (called mainCRTStartup) which does the same setup
(plus opening a console if none is open and setting up stdio which the
WinMain version doesn't) and then invokes main().

The startup function is an interesting read - it has more work to do on
windows than the unix equivalent, because systems like signals (which
are in ANSI), file descriptor based I/O (which is not ANSI but
nevertheless is implemented in MSVC), and such, that are "naturally
occuring" on unix have to be set up. The whole program executes in a
__try/__except block to allow them to make signals work, for example.




  reply	other threads:[~2012-02-25 22:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-22 19:17 arnold
2012-02-22 21:22 ` Dave Horsfall
2012-02-22 22:47   ` A. P. Garcia
2012-02-23  4:30   ` Greg 'groggy' Lehey
2012-02-25 18:45     ` Random832
2012-02-25 19:24       ` Steve Nickolas
2012-02-25 20:39       ` John Cowan
2012-02-25 22:15         ` Random832 [this message]
2012-02-26 13:28           ` Ronald Natalie
2012-02-27  1:30             ` random832
  -- strict thread matches above, loose matches on Subject: below --
2012-02-20 20:52 arnold
2012-02-20 23:21 ` Dave Horsfall
2012-02-21  0:34   ` Brantley Coile
2012-02-21  2:50     ` Warner Losh
2012-02-21  3:33       ` John Cowan
2012-02-21  3:41       ` Steve Nickolas
2012-02-21 18:18       ` ron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F495D84.8030206@fastmail.us \
    --to=random832@fastmail.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).