Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Why I use gcc Date: Tue, 27 Sep 2016 08:46:26 -0700 Organization: None to speak of Lines: 34 Message-ID: References: <591c35dc-315d-4293-bf36-53ffa8eb044d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="23050"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/CT9AYmZ7EnIMlZYG8qxko" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:VEMyM/brYkJEcHjnFy5LKKfUxBk= sha1:48q9fKY3mMke3SSfIpa7w74JAIA= Xref: csiph.com comp.lang.c:94151 David Brown writes: > On 27/09/16 12:22, BartC wrote: [...] >> Why doesn't the language acknowledge the existence of foreign functions? >> >> That is, that there might be other languages that do things differently, >> but a C program might want to call functions in that other language, and >> vice versa. >> >> This could be one reason why there are several different conventions >> even on the same target. (On x64, I use my own convention different from >> both the Win64 and Linux64 ABI. Within the language I use foreign >> function attributes such as 'windows' and 'clang'.) >> >> C seems to assume that a C program will only ever call a C function. > > The C language standards only discuss C - they don't deal with calling > other functions because that would be outside the scope of C. That's not inherently necessary. A number of other language standards (C++, Ada) *do* provide facilities for calling code in other languages. I think the reasons the C standard doesn't do so are historical. Such features could have been added by one of the C standards, but they weren't -- perhaps because compilers already had their own mechanisms and it wasn't practical to reconcile them. It was a missed opportunity. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"