The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: imp@bsdimp.com (Warner Losh)
Subject: [TUHS] why the leading under score added to function names?
Date: Mon, 20 Feb 2012 19:50:00 -0700	[thread overview]
Message-ID: <AAE63D3D-4F18-41E3-9059-7F885D6B29F5@bsdimp.com> (raw)
In-Reply-To: <96DE558D-5FE2-4F6F-BC83-18EC727162FA@coraid.com>

And this convention went away with ELF binaries.  No more _foo for function foo.

Also, the fortran compiler would emit entry_ to as to not conflict either.  Made calling C from Fortran, and vice versa, a lot of fun...

Warner

On Feb 20, 2012, at 5:34 PM, Brantley Coile wrote:

> correct.  we could link to assembler code with _entry points and not worry about symbol collisions in the rest of the code. 
> 
> iPhone email
> 
> On Feb 20, 2012, at 6:23 PM, "Dave Horsfall" <dave at horsfall.org> wrote:
> 
>> On Mon, 20 Feb 2012, arnold at skeeve.com wrote:
>> 
>> [...]
>> 
>>> I'm pretty sure this dates back to PDP-11 days.  I'm wondering "why?".
>>> Why did the C compiler prepend an underscore to function names?
>> 
>> Sure was the PDP-11 :-)  I vaguely recall that it was to make sure that
>> user functions did not conflict with predefined assembler functions, as
>> that would be a pain to diagnose (much like having swap overlap root).
>> 
>> -- Dave
>> _______________________________________________
>> TUHS mailing list
>> TUHS at minnie.tuhs.org
>> https://minnie.tuhs.org/mailman/listinfo/tuhs
> _______________________________________________
> TUHS mailing list
> TUHS at minnie.tuhs.org
> https://minnie.tuhs.org/mailman/listinfo/tuhs
> 
> 




  reply	other threads:[~2012-02-21  2:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2012-02-21  3:33       ` John Cowan
2012-02-21  3:41       ` Steve Nickolas
2012-02-21 18:18       ` ron
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
2012-02-26 13:28           ` Ronald Natalie
2012-02-27  1:30             ` random832

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=AAE63D3D-4F18-41E3-9059-7F885D6B29F5@bsdimp.com \
    --to=imp@bsdimp.com \
    /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).