Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #103906

Re: Is 'extern' necessary?

From BartC <bc@freeuk.com>
Newsgroups comp.lang.c
Subject Re: Is 'extern' necessary?
Date 2017-02-14 20:22 +0000
Organization A noiseless patient Spider
Message-ID <o7voq8$hnb$1@dont-email.me> (permalink)
References (10 earlier) <o7uqci$bg$1@dont-email.me> <87vascn13j.fsf@news.bourguet.org> <lnd1ekslyx.fsf@kst-u.example.com> <o7vijo$pun$1@dont-email.me> <ca07b3fc-303f-4a88-9cf8-63b383efd8a1@googlegroups.com>

Show all headers | View raw


On 14/02/2017 19:42, supercat@casperkitty.com wrote:
> On Tuesday, February 14, 2017 at 12:36:30 PM UTC-6, Bart wrote:
>> People say that a C compiler is independent of any set of headers, but
>> then if you try and run one compiler with another's standard headers,
>> you run into problems.
>
> A conforming C implementation will generally need to contain a compiler and
> a set of libraries which work with each other (in theory, the compiler could
> include within itself all of the logic to produce inline code for all
> "standard library" functions, and consequently not need any other library,
> but in practice that isn't done).

The implementation I'm working on won't have its own C library. It'll 
use what's already available (in msvcrt.dll or libc.so.6).

Maybe there are various new C functions that are not included in those 
two libraries and that I'd have to provide (I'm only familiar with a 
tiny part of the library) in which case they will probably be provided 
inside my program (or more likely, I won't bother; this is only an 
experiment done for fun).

I haven't worked out what to do about standard headers; probably they 
will be built-in (no physical external files). And specific to the compiler.

(But for things such as windows.h, and for any other libraries not part 
of the language, they will need to be provided by a host, as it's too 
much work otherwise. Preferably not gcc/mingw, as that involves 150 
files/340K lines, and is probably full of gcc-specific dependencies so 
wouldn't work.)

> Given that a library must contain functions which can be invoked through the
> prototypes defined by the Standard, I'm not sure what a library could
> include in its headers, beyond the definitions given in the Standard, without
> relying upon compiler-specific extensions.  I would think there would be a
> lot more room for a compiler to use its own headers to supplant standard
> library functions with intrinsics.

Well, clang (on Windows anyway) used to work with a local gcc's headers, 
now it works with MSVC's header, as well as using their linkers.

So it can be done, although clang is not small nor that much faster at 
compiling that gcc. (You do wonder what on earth is inside its 50MB 
executable since most things are borrowed from elsewhere!)

-- 
bartc

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-10 17:16 +0000
  Re: Is 'extern' necessary? Keith Thompson <kst-u@mib.org> - 2017-02-10 09:33 -0800
    Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-10 18:41 +0000
      Re: Is 'extern' necessary? Keith Thompson <kst-u@mib.org> - 2017-02-10 12:09 -0800
        Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-10 20:29 +0000
          Re: Is 'extern' necessary? Keith Thompson <kst-u@mib.org> - 2017-02-10 13:26 -0800
            Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-10 22:56 +0000
              Re: Is 'extern' necessary? jameskuyper@verizon.net - 2017-02-10 20:19 -0800
                Re: Is 'extern' necessary? "James R. Kuyper" <jameskuyper@verizon.net> - 2017-02-11 09:53 -0500
              Re: Is 'extern' necessary? Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-13 05:19 -0800
      Re: Is 'extern' necessary? jameskuyper@verizon.net - 2017-02-10 12:09 -0800
        Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-10 20:50 +0000
          Re: Is 'extern' necessary? supercat@casperkitty.com - 2017-02-10 13:09 -0800
          Re: Is 'extern' necessary? Keith Thompson <kst-u@mib.org> - 2017-02-10 13:33 -0800
          Re: Is 'extern' necessary? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-10 23:23 +0000
            Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-10 23:35 +0000
              Re: Is 'extern' necessary? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-11 00:34 +0000
            Re: Is 'extern' necessary? David Brown <david.brown@hesbynett.no> - 2017-02-13 12:41 +0100
              Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-13 13:14 +0000
                Re: Is 'extern' necessary? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-13 14:05 +0000
                Re: Is 'extern' necessary? jameskuyper@verizon.net - 2017-02-13 07:49 -0800
          Re: Is 'extern' necessary? jameskuyper@verizon.net - 2017-02-10 19:33 -0800
            Re: Is 'extern' necessary? supercat@casperkitty.com - 2017-02-11 09:41 -0800
              Re: Is 'extern' necessary? Keith Thompson <kst-u@mib.org> - 2017-02-11 10:19 -0800
                Re: Is 'extern' necessary? "James R. Kuyper" <jameskuyper@verizon.net> - 2017-02-11 13:39 -0500
                Re: Is 'extern' necessary? supercat@casperkitty.com - 2017-02-12 10:10 -0800
      Re: Is 'extern' necessary? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2017-02-10 14:59 -0800
      Re: Is 'extern' necessary? David Brown <david.brown@hesbynett.no> - 2017-02-13 12:33 +0100
  Re: Is 'extern' necessary? Siri Cruise <chine.bleu@yahoo.com> - 2017-02-10 09:35 -0800
    Re: Is 'extern' necessary? Keith Thompson <kst-u@mib.org> - 2017-02-10 12:12 -0800
  Re: Is 'extern' necessary? jameskuyper@verizon.net - 2017-02-10 10:38 -0800
  Re: Is 'extern' necessary? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-10 21:10 +0000
    Re: Is 'extern' necessary? supercat@casperkitty.com - 2017-02-10 13:25 -0800
  Re: Is 'extern' necessary? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2017-02-10 14:53 -0800
    Re: Is 'extern' necessary? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2017-02-10 15:06 -0800
    Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-10 23:24 +0000
      Re: Is 'extern' necessary? Ian Collins <ian-news@hotmail.com> - 2017-02-11 12:34 +1300
        Re: Is 'extern' necessary? David Brown <david.brown@hesbynett.no> - 2017-02-13 13:14 +0100
          Re: Is 'extern' necessary? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-02-13 13:44 +0100
            Re: Is 'extern' necessary? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-13 14:13 +0000
            Re: Is 'extern' necessary? David Brown <david.brown@hesbynett.no> - 2017-02-13 15:16 +0100
              Re: Is 'extern' necessary? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-02-13 17:24 +0100
                Re: Is 'extern' necessary? "James R. Kuyper" <jameskuyper@verizon.net> - 2017-02-13 14:24 -0500
                Re: Is 'extern' necessary? David Brown <david.brown@hesbynett.no> - 2017-02-13 23:29 +0100
            Re: Is 'extern' necessary? Keith Thompson <kst-u@mib.org> - 2017-02-13 11:06 -0800
            Re: Is 'extern' necessary? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2017-02-13 11:15 -0800
          Re: Is 'extern' necessary? "James R. Kuyper" <jameskuyper@verizon.net> - 2017-02-13 11:48 -0500
            Re: Is 'extern' necessary? supercat@casperkitty.com - 2017-02-13 09:03 -0800
            Re: Is 'extern' necessary? David Brown <david.brown@hesbynett.no> - 2017-02-13 23:37 +0100
      Re: Is 'extern' necessary? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2017-02-10 15:40 -0800
      Re: Is 'extern' necessary? Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-13 05:09 -0800
        Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-13 13:46 +0000
          Re: Is 'extern' necessary? Keith Thompson <kst-u@mib.org> - 2017-02-13 09:52 -0800
            Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-13 19:19 +0000
              Re: Is 'extern' necessary? Keith Thompson <kst-u@mib.org> - 2017-02-13 11:34 -0800
                Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-13 20:13 +0000
              Re: Is 'extern' necessary? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2017-02-13 13:11 -0800
              Re: Is 'extern' necessary? David Brown <david.brown@hesbynett.no> - 2017-02-14 00:33 +0100
                Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-14 01:02 +0000
                Re: Is 'extern' necessary? David Brown <david.brown@hesbynett.no> - 2017-02-14 09:28 +0100
                Re: Is 'extern' necessary? Robert Wessel <robertwessel2@yahoo.com> - 2017-02-14 03:31 -0600
                Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-14 11:42 +0000
                Re: Is 'extern' necessary? David Brown <david.brown@hesbynett.no> - 2017-02-14 13:29 +0100
                Re: Is 'extern' necessary? supercat@casperkitty.com - 2017-02-14 05:16 -0800
                Re: Is 'extern' necessary? David Brown <david.brown@hesbynett.no> - 2017-02-14 14:51 +0100
                Re: Is 'extern' necessary? supercat@casperkitty.com - 2017-02-14 07:24 -0800
                Re: Is 'extern' necessary? David Brown <david.brown@hesbynett.no> - 2017-02-14 21:35 +0100
                Re: Is 'extern' necessary? James Kuyper <jameskuyper@verizon.net> - 2017-02-14 15:53 -0500
                Re: Is 'extern' necessary? David Brown <david.brown@hesbynett.no> - 2017-02-15 09:31 +0100
                Re: Is 'extern' necessary? "James R. Kuyper" <jameskuyper@verizon.net> - 2017-02-15 11:36 -0500
                Re: Is 'extern' necessary? Keith Thompson <kst-u@mib.org> - 2017-02-15 09:12 -0800
                Re: Is 'extern' necessary? "James R. Kuyper" <jameskuyper@verizon.net> - 2017-02-15 12:58 -0500
                Re: Is 'extern' necessary? supercat@casperkitty.com - 2017-02-15 10:01 -0800
                Re: Is 'extern' necessary? jameskuyper@verizon.net - 2017-02-15 10:55 -0800
                Re: Is 'extern' necessary? supercat@casperkitty.com - 2017-02-15 11:42 -0800
                Re: Is 'extern' necessary? jameskuyper@verizon.net - 2017-02-15 12:28 -0800
                Re: Is 'extern' necessary? supercat@casperkitty.com - 2017-02-15 13:58 -0800
                Re: Is 'extern' necessary? Keith Thompson <kst-u@mib.org> - 2017-02-14 08:54 -0800
                Re: Is 'extern' necessary? Keith Thompson <kst-u@mib.org> - 2017-02-14 08:51 -0800
                Re: Is 'extern' necessary? Richard Heathfield <rjh@cpax.org.uk> - 2017-02-14 17:32 +0000
                Re: Is 'extern' necessary? Gareth Owen <gwowen@gmail.com> - 2017-02-14 17:45 +0000
                Re: Is 'extern' necessary? David Brown <david.brown@hesbynett.no> - 2017-02-14 21:38 +0100
                Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-14 23:26 +0000
                Re: Is 'extern' necessary? Keith Thompson <kst-u@mib.org> - 2017-02-14 16:33 -0800
                Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-15 00:47 +0000
                Re: Is 'extern' necessary? Jean-Marc Bourguet <jm@bourguet.org> - 2017-02-14 18:17 +0100
                Re: Is 'extern' necessary? Keith Thompson <kst-u@mib.org> - 2017-02-14 09:47 -0800
                Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-14 18:36 +0000
                Re: Is 'extern' necessary? jameskuyper@verizon.net - 2017-02-14 11:20 -0800
                Re: Is 'extern' necessary? supercat@casperkitty.com - 2017-02-14 11:42 -0800
                Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-14 20:22 +0000
                Re: Is 'extern' necessary? Robert Wessel <robertwessel2@yahoo.com> - 2017-02-14 17:58 -0600
                Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-15 01:29 +0000
                Re: Is 'extern' necessary? Robert Wessel <robertwessel2@yahoo.com> - 2017-02-16 05:02 -0600
                Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-16 11:38 +0000
                Re: Is 'extern' necessary? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-16 14:37 +0000
                Re: Is 'extern' necessary? BartC <bc@freeuk.com> - 2017-02-16 15:43 +0000
                Re: Is 'extern' necessary? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-16 16:08 +0000
                Re: Is 'extern' necessary? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-02-16 18:42 +0100
                Re: Is 'extern' necessary? David Brown <david.brown@hesbynett.no> - 2017-02-15 09:47 +0100
                Re: Is 'extern' necessary? Robert Wessel <robertwessel2@yahoo.com> - 2017-02-16 05:05 -0600
          Re: Is 'extern' necessary? Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-15 16:53 -0800
    Re: Is 'extern' necessary? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-10 23:55 +0000
  Re: Is 'extern' necessary? Les Cargill <lcargill99@comcast.com> - 2017-02-10 19:24 -0600
  Re: Is 'extern' necessary? void <nathan.gothier@gmail.com> - 2017-02-11 03:17 -0800

csiph-web