Article View: comp.lang.c
Article #1990Re: C and its peasant 'ancestors'
From: Keith Thompson
Date: Mon, 30 Nov 2026 01:21
Date: Mon, 30 Nov 2026 01:21
45 lines
3480 bytes
3480 bytes
cross@spitfire.i.gajendra.net (Dan Cross) writes:
> In article <11eieib$3v2hj$1@kst.eternal-september.org>,
> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
[...]
>>I'm not aware that there's any widely accepted definition of
>>"strongly typed". And I would argue that "strong typing" cannot
>>be measured along a single continuum, with "weakly typed" languages
>>at one end and "strongly typed" languages at the other. One language
>>might have strong typing enforced at run time; another might have
>>weak typing enforced at compile time.
>
> No, these terms of art that are, as I understand it, fairly well
> understood in the PL community. Generally, "strong typed" means
> "no implicit conversions", and "statically typed" means "types
> are known at compile time."
You may well be right about that. On the other hand, I think there
are a lot of people who don't use the terms that way, and some of
them participate in discussions like this one. (I'm not referring
to anyone in particular.)
In the particular case of "hello" + 1 being valid in C, there are
two things going on. One is the implicit conversion of the array
expression "hello" to a pointer expression; that's weak typing.
The other is the existence of a + operator that takes pointer and
integer operands; that's just a weird operator, no more weakly
typed than Pythons "foo" * 3" or Perl's "foo" x 3.
A digression: I'm not happy that C's array-to-pointer conversion is
referred to as a "conversion". It's not like other type conversions.
An ordinary type conversion is an operation (either performed
implicitly or specified by a cast operator) that takes an operand of
some type, and the result depends only on the *value* of the operand.
It notionally happens at run time, but can sometimes be optimized
to occur at compile time.
The array-to-pointer conversion could more accurately be described as
a compile-time *adjustment*, similar to the array-to-pointer parameter
adjustment (for which the standard does use the word "adjusted").
Likewise for function-to-pointer conversions.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Technical Details
Message-ID:
<11eij2a$hq5$1@kst.eternal-september.org>Path:
mbox-mo1.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!kst.eternal-september.org!.POSTED!not-for-mailReferences:
<11dup6q$v4j9$1@dont-email.me> <20261130010153.00003664@yahoo.com> <11eibdf$snv$1@reader2.panix.com> <11eieib$3v2hj$1@kst.eternal-september.org> <11eifmr$4dk$1@reader2.panix.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!kst.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson <Keith.S.Thompson+u@gmail.com> Newsgroups: comp.lang.c Subject: Re: C and its peasant 'ancestors' Date: Sun, 29 Nov 2026 17:21:14 -0800 Organization: None to speak of Lines: 45 Message-ID: <11eij2a$hq5$1@kst.eternal-september.org> References: <11dup6q$v4j9$1@dont-email.me> <20261130010153.00003664@yahoo.com> <11eibdf$snv$1@reader2.panix.com> <11eieib$3v2hj$1@kst.eternal-september.org> <11eifmr$4dk$1@reader2.panix.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Mon, 30 Nov 2026 01:21:14 +0000 (UTC) Injection-Info: kst.eternal-september.org; logging-data="18245"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4lRBHOjdxONGbxAi8xbAF"; posting-host="63d87a7fc42574551319d0c4fff9e99c" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:ghH1jsT5DV4No3KEC1PWlCMXiuc= sha256:UJfn/dDzoodZxujg4dQAk3pPrLUUAnrnkC87M0ijKsE= sha1:nqB4z+CO2CUZ+jm+e75ZfPScCJI= sha256:1Zl67FkO3SA9YoBjSbTT9yRv1wecYDyv4munUL7BpTs=