Article View: comp.lang.c
Article #1987Re: C and its peasant 'ancestors'
From: Keith Thompson
Date: Mon, 30 Nov 2026 00:04
Date: Mon, 30 Nov 2026 00:04
60 lines
4176 bytes
4176 bytes
cross@spitfire.i.gajendra.net (Dan Cross) writes:
> In article <20261130010153.00003664@yahoo.com>,
> Michael S <already5chosen@yahoo.com> wrote:
[...]
>>There is a whole continuum of possibilities between strongly typed and
>>untyped.
>
> Then you should explain yourself.
>
> "Python is strongly typed. It is of little practical
> importance." What, precisely, did you mean? And why do you
> consider it of, "little importance?"
I think this is devolving into an debate that's mostly about the
meanings of English phrases like "strongly typed" rather than about the
semantics of various programming languages.
I do agree that if someone is going to say a language is "strongly
typed", they should probably explain just what they mean by that.
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.
> To tie this back to C, C is a weakly-typed language; add a
> number to a string literal and the result is a pointer. This
> has been a source of a _huge_ number of bugs over the years.
I can imagine a definition of "weakly-typed" that applies to C,
probably based on its rather promiscuous implicit conversions. On
the other hand, every C expression has an unambiguous type, determined
entirely by the expression itself and the rules of the language.
(The conversion/adjustment of expressions of function an array
type is arguably an exception to this, but one that's completely
specified by the language rules).
Adding an integer to a string literal yields a pointer because
(a) an array expression, such as a string literal, is "converted"
to a pointer expression in most contexts, and (b) there exists an
addition operator that takes a pointer and an integer and yields
a pointer. (And I'm skeptical that this has been a source of a
huge number of bugs.) Python allows a string to be multiplied by
an integer; "foo" * 3 yields "foofoofoo".
In a typical assembly language, you can load two floating-point values
into registers and apply a bitwise xor to them as easily as you can
multiply them. You can't do that in most higher-level languages,
including C, without extra steps that make the weirdness explicit. In
Python, you can assign an expression of any type to a variable named
"x"; the type is associated with the value, not with the variable.
C doesn't do that. I would argue that most assembly languages are
very weakly typed, but I wouldn't necessary say that C is more
strongly typed than Python is or vice versa.
--
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:
<11eieib$3v2hj$1@kst.eternal-september.org>Path:
mbox-mo1.pugleaf.net!srv.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> <20261130000723.0000290f@yahoo.com> <11eia4j$4k4$1@reader2.panix.com> <20261130010153.00003664@yahoo.com> <11eibdf$snv$1@reader2.panix.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.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 16:04:26 -0800 Organization: None to speak of Lines: 60 Message-ID: <11eieib$3v2hj$1@kst.eternal-september.org> References: <11dup6q$v4j9$1@dont-email.me> <20261130000723.0000290f@yahoo.com> <11eia4j$4k4$1@reader2.panix.com> <20261130010153.00003664@yahoo.com> <11eibdf$snv$1@reader2.panix.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Mon, 30 Nov 2026 00:04:28 +0000 (UTC) Injection-Info: kst.eternal-september.org; logging-data="4164147"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18oJ8+22Ko2oK/J5bJ1sWyc"; posting-host="63d87a7fc42574551319d0c4fff9e99c" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:N96UVfeKO06Pb6wb2qmPzA6nC28= sha256:2YF2Ntpg6/EK5PKXnE6gX5N555KECijr87wxLSzm4hg= sha1:aA9cLc9ZaQEK6jFQGVJK+XZASNE= sha256:cS0Uf1cZOktOpdU3STEr0tJtjpS3uXb2ejkPoFa9gqY=