Deutsch   English   Français   Italiano  
<86ttfqin3x.fsf@linuxsc.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch <tr.17687@z991.linuxsc.com>
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: <v8vlo9$2oc1v$1@dont-email.me> <slrnvb7kis.28a.dan@djph.net> <v929ah$3u7l7$1@dont-email.me> <87ttfu94yv.fsf@nosuchdomain.example.com> <v93a3t$6q7v$1@dont-email.me> <v93e2q$8put$1@dont-email.me> <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=
Bytes: 1671

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Bart <bc@freeuk.com> 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.