Article View: comp.lang.c
Article #545Re: Taming The Switch-Statement
From: Dan Cross
Date: Mon, 19 Oct 2026 12:00
Date: Mon, 19 Oct 2026 12:00
52 lines
3474 bytes
3474 bytes
In article <11b4n9g$4fik$2@paganini.bofh.team>,
Waldek Hebisch <antispam@fricas.org> wrote:
>Dan Cross <cross@spitfire.i.gajendra.net> wrote:
>> In article <11b0mfv$j5ll$1@dont-email.me>, bart <bc@freeuk.com> wrote:
>>
>>>C is a terrible choice for a cross-language API, as too many C-isms
>>>creep in (like C macros, or vaguely defined types, including the famous
>>>'plain char' that exists in no other language, which is neither signed
>>>nor unsigned, and above all C preprocessor features).
>>
>> That's why ABIs matter.
>>
>> Look at the Vax-11 Procedure Calling and Condition Handling
>> Standard from VMS 2.0; they simply wrote down what this stuff
>> meant, and you could call between essentially any language on
>> that system, whether it was C, Fortran, Bliss, COBOL, or
>> whatever.
>
>That is getting off-topic, but I looked at VMS documentation.
>Simple cases are described with a lot of details. But I was
>unable to find general case. Say, given array of structs
>containing notrivial types like arrays inside. It seems that
>for such types it is essentially "whatever language processor
>decides to do" and the other end must know the convention.
>Which seem to be exactly what happens on other platforms.
I imagine in that case one would use an array descriptor to
describe the array, and then a more specific descriptor (or set
of) to describe the structure of each element of the array.
In any event, the thing they did that's relevant here is
describing the properties of the basic types (what the VAX-11
run-time library reference manual calls, "atomic types", which
should not be confused with what we now call atomic types, that
have specific properties on multi-CPU systems; the VMS 2.0 docs
just meant the primitive data types understood by the VAX
hardware; bytes words, long/quad/octowords, and so on).
The point I was trying to make, and how it's relevant to C, is
that this is an early-ish example of what we now would think of
as an ABI, and it made (say) inter-language procedures calls
tractable. I don't know quite how to articulate it in a way
that won't kick over the language-lawyer hornet's nest, but
informally, the C standard doesn't mandate any particular ABI,
and indeed, tries to steer clear of such things to the extent
that it can. Bart complains about the need to deal with the "C
API", but really, he's referring to ABI issues ("is `char`
signed or not?" The ISO C doesn't say, but within each ABI, we
know.
- Dan C.
Technical Details
Message-ID:
<11b50pe$ekp$1@reader2.panix.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!panix!.POSTED.spitfire.i.gajendra.net!not-for-mailReferences:
<119qf6l$2rmg3$1@dont-email.me> <11b0mfv$j5ll$1@dont-email.me> <11b3r71$6me$1@reader2.panix.com> <11b4n9g$4fik$2@paganini.bofh.team>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail From: cross@spitfire.i.gajendra.net (Dan Cross) Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Mon, 19 Oct 2026 12:00:46 -0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: <11b50pe$ekp$1@reader2.panix.com> References: <119qf6l$2rmg3$1@dont-email.me> <11b0mfv$j5ll$1@dont-email.me> <11b3r71$6me$1@reader2.panix.com> <11b4n9g$4fik$2@paganini.bofh.team> Injection-Date: Mon, 19 Oct 2026 12:00:46 -0000 (UTC) Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80"; logging-data="15001"; mail-complaints-to="abuse@panix.com" X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Originator: cross@spitfire.i.gajendra.net (Dan Cross)