Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: David Brown Newsgroups: comp.arch Subject: Re: Computer architects leaving Intel... Date: Thu, 5 Sep 2024 09:54:56 +0200 Organization: A noiseless patient Spider Lines: 32 Message-ID: References: <2024Aug30.161204@mips.complang.tuwien.ac.at> <505954890d8461c1f4082b1beecd453c@www.novabbs.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 05 Sep 2024 09:54:56 +0200 (CEST) Injection-Info: dont-email.me; posting-host="622309b8b3e203ac6e38dece30d12fb2"; logging-data="281604"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19OamNjF5pwePmUhMdOjAf/J8LOmqZJmwk=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Cancel-Lock: sha1:ycE7dEeBi4y3pRgN6uP3Lbuj4IA= In-Reply-To: Content-Language: en-GB Bytes: 2837 On 05/09/2024 02:56, MitchAlsup1 wrote: > On Thu, 5 Sep 2024 0:41:36 +0000, BGB wrote: > >> On 9/4/2024 3:59 PM, Scott Lurndal wrote: >> >> Say: >>    long z; >>    int x, y; >>    ... >>    z=x*y; >> Would auto-promote to long before the multiply. > > \I may have to use this as an example of C allowing the programmer > to shoot himself in the foot; promotion or no promotion. You snipped rather unfortunately here - it makes it look like this was code that Scott wrote, and you've removed essential context by BGB. While I agree it is an example of the kind of code that people sometimes write when they don't understand C arithmetic, I don't think it is C-specific. I can't think of any language off-hand where expressions are evaluated differently depending on types used further out in the expression. Can you give any examples of languages where the equivalent code would either do the multiplication as "long", or give an error so that the programmer would be informed of their error? (I don't count personal one-person languages here. They are very rarely formally or accurately specified.)