Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: C wish list Date: Thu, 21 Mar 2019 12:43:40 -0700 Organization: None to speak of Lines: 32 Message-ID: References: <711b315c-832b-4677-a0c6-82b1fe65803a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="9515313518a1e23526d751bd086ff0bd"; logging-data="25093"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+czV0NGRuJQqrb+l/eDwoC" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:Z3Z6nvfsc2/XSvCEly690sIYmpE= sha1:EumengabLzfjp8tzsAxWIjG15oI= Xref: csiph.com comp.lang.c:142198 Howard Chu writes: [...] > This is already a problem with the current syntax. CPUs don't have > *signed integers*, they have *integers*. They have signed or unsigned > *operators* for performing arithmetic on them - e.g. x86 MUL for > unsigned multiplication, IMUL for signed multiplication. They have a > single left-shift instruction because left-shift makes no difference > whether you're doing signed or unsigned math. They have two > right-shift instructions, one which shifts in 0 bits at the top, and > one which shifts in copies of the sign bit at the top. But the sign > bit isn't "special", it doesn't live in a separate memory or register > space. It is merely the top-most bit of the word. They don't have > signed vs unsigned Add or Subtract instructions because there is no > difference. None of this is a "problem". C is not a high-level assembly language. And not all CPUs have the characteristics you describe. > For a language that evolved from PDP-11 assembly language, it has > strayed pretty far from its roots. Words in a computer memory don't > have types. They're just bytes; they're just sequences of bits. The > only things that have "types" are the instructions that operate on > them. C did not evolve from PDP-11 assembly language. It evolved from B, which evolved from BCPL, which evolved from CPL, which was implemented before the PDP-11 existed. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */