From: random832@fastmail.us (Random832)
Subject: [TUHS] why the leading under score added to function names?
Date: Sat, 25 Feb 2012 13:45:23 -0500 [thread overview]
Message-ID: <4F492C43.3020602@fastmail.us> (raw)
In-Reply-To: <20120223043021.GA72269@dereel.lemis.com>
On 2/22/2012 11:30 PM, Greg 'groggy' Lehey wrote:
> On Thursday, 23 February 2012 at 8:22:17 +1100, Dave Horsfall wrote:
>> On Wed, 22 Feb 2012, arnold at skeeve.com wrote:
>>> It also shows the consequences a small, apparently local decision
>>> can have: here we are 40+ years later and GCC on Windows is still
>>> preprending underscores to function names!
>> When it comes to Windoze, nothing surprises me any more. Unix has
>> evolved over the years, but Windoze was spat out and hatched.
> I'm no friend of Microsoft either, but gcc isn't exactly Microsoft.
> What Arnold mentions here is Unix history in action.
>
Yes and no. IIRC, gcc doesn't do that on, for example, Linux ELF. it's
done on windows, I assume, in deference to the windows 32-bit ABI for
cdecl calling convention functions.
Now, as far as where windows gets that from (just because something
evolved within one company doesn't mean it didn't evolve), supposedly
early versions of Microsoft C (pre-ANSI) were very conservative in terms
of adhering to the "standard" set by Unix C and K&R - this could have
extended to the prepending of underscores. 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). I would
also guess it's why MSVC stdio is implemented on top of an imitation of
Unix system calls which is in turn implemented on top of DOS/windows;
and why MSVC time_t is defined as seconds since 1970. There are comments
in the code referring to XENIX in various places relating to I/O and
timestamps, so it's possible that MSVC's C library was indeed, to some
small degree, based on Unix.
next prev parent reply other threads:[~2012-02-25 18:45 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 [this message]
2012-02-25 19:24 ` Steve Nickolas
2012-02-25 20:39 ` John Cowan
2012-02-25 22:15 ` Random832
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=4F492C43.3020602@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).