Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Richard Heathfield Newsgroups: comp.theory Subject: Re: Every sufficiently competent C programmer knows Date: Wed, 12 Mar 2025 10:00:50 +0000 Organization: Fix this later Lines: 26 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 12 Mar 2025 11:00:50 +0100 (CET) Injection-Info: dont-email.me; posting-host="1e46a42d02300691bd0ac693a83620d5"; logging-data="2617103"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+n0F6coMH72huys51BpL+N/caCEQx+nwHNTkRH/yi7VQ==" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:dCInJhbzGqYiMM8Kbmh0W6Bi5wU= Content-Language: en-GB In-Reply-To: Bytes: 1905 On 12/03/2025 09:49, Mikko wrote: > On 2025-03-11 18:23:24 +0000, Richard Heathfield said: > >> int rhc(unsigned int i) >> { >>    typedef int(*pf)(unsigned int); >>    pf arr[3] = {rha, rhb, rhc}; >>    return arr[i % 3]; > > The return instruction has wrong type. Good spot, but no, it's fine. The bug is elsewhere. That line should read: return arr[i % 3](i); arr is of type int(*)(unsigned int)[3] arr[i % 3] is of type int(*)(unsigned int) arr[i % 3](i) is a function call returning int -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within