Path: csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: how cast works?
Date: Sun, 11 Aug 2024 17:46:58 -0700
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <86ttfqin3x.fsf@linuxsc.com>
References: <87ttfu94yv.fsf@nosuchdomain.example.com> <87bk228uzg.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Mon, 12 Aug 2024 02:46:59 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="f42e4005105099d89c60a754521770ce"; logging-data="3093877"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pLwDjFIhIx+9elkohCxFH6iKyqHKb4HI="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:3HUubM82aLmvF46TRfDrGSPpFuA= sha1:dmOmm5vy5pTFS0tVdmGZHOnqTfA=
Xref: csiph.com comp.lang.c:387493
Keith Thompson writes:
> Bart writes:
> [...]
>
>> Take:
>>
>> int a; double x;
>>
>> x = (double)a;
>>
>> The cast is implicit here but I've written it out to make it clear.
>
> [...]
>
> The *conversion* could be done implicitly, but you've used a cast (i.e.,
> an explicit conversion) to make it clear.
The statement assigning to x performs two conversions: an explicit
one caused by the cast, and an implicit one caused by the assignment
operation.