Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <87y156953x.fsf@nosuchdomain.example.com>
Deutsch   English   Français   Italiano  
<87y156953x.fsf@nosuchdomain.example.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: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: how cast works?
Date: Thu, 08 Aug 2024 12:39:14 -0700
Organization: None to speak of
Lines: 37
Message-ID: <87y156953x.fsf@nosuchdomain.example.com>
References: <v8vlo9$2oc1v$1@dont-email.me>
	<87frrg9jud.fsf@nosuchdomain.example.com>
	<v92aha$3u7l7$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Thu, 08 Aug 2024 21:39:15 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="e4aa1d660b902ae3f8bff1af6f96edaf";
	logging-data="216371"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/N3/JLUZ2epiTdTOoNGzpi"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:tZe0UtUqbKroqIllmlcpxZIoYTg=
	sha1:Jxpcms81yqsAfoy5lSN1baxT/eQ=
Bytes: 2271

Thiago Adams <thiago.adams@gmail.com> writes:
> On 07/08/2024 17:08, Keith Thompson wrote:
>> Thiago Adams <thiago.adams@gmail.com> writes:
>>> How cast works?
>>> Does it changes the memory?
>>> For instance, from "unsigned int" to "signed char".
>>> Is it just like discarding bytes or something else?
>
> I also curious about how bool works.
>
> Values converted to bool became 0 or 1.
> When this conversion happens, at read or write? Both?

I don't know what you mean by that.

A conversion takes a value of some type and yields a value of some
(other) type.  If the target type is bool, the result is false (0) if
the operand is equal to zero, true (1) otherwise.

A cast is simply an explicit conversion.  Explict and implicit
conversions do the same thing.  (Some conversions can only be done
explicitly.)

A converted value does not "become" 0 or 1; the conversion *yields*
0 or 1.  The value of (bool)42 is 1, but 42 is still 42.

> How much does it cost?

It depends on what code the compiler generates; the language doesn't
address that.  It could be free if the result isn't used and the
compiler optimizes it away.

[...]

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */