[TUHS] why the leading under score added to function names?

arnold at skeeve.com arnold at skeeve.com
Thu Feb 23 05:17:28 AEST 2012


Hi All.

This is interesting. It shows that (apparently) early on, assembler was
viewed as the primary programming language.

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!

In 15 minutes I helped the guy at work solve a problem he'd been working
on for two days!

Thanks everyone,

Arnold

> From: Brantley Coile <brantley at coraid.com>
> To: Dave Horsfall <dave at horsfall.org>
> Date: Mon, 20 Feb 2012 18:34:26 -0600
> Cc: The Eunuchs Hysterical Society <tuhs at tuhs.org>
> Subject: Re: [TUHS] why the leading under score added to function names?
>
> correct.  we could link to assembler code with _entry points and not
i> 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



More information about the TUHS mailing list