Warning: mysqli::__construct(): (HY000/2002): No connection could be made because the target machine actively refused it. in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (2002) No connection could be made because the target machine actively refused it.
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <vrhadc$3e7sn$3@dont-email.me>
Deutsch   English   Français   Italiano  
<vrhadc$3e7sn$3@dont-email.me>

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

Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: Re: int a = a (Was: Bart's Language)
Date: Thu, 20 Mar 2025 15:57:48 +0100
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <vrhadc$3e7sn$3@dont-email.me>
References: <vracit$178ka$1@dont-email.me> <vrc2d5$1jjrf$1@paganini.bofh.team>
 <vrc4eb$2p28t$1@dont-email.me> <vrc75b$2r4lt$1@dont-email.me>
 <vrccjb$b3m6$1@news.xmission.com> <vrcef2$33076$1@dont-email.me>
 <vrelvn$12ddq$1@dont-email.me> <aqCCP.590465$SZca.348513@fx13.iad>
 <864izooz0w.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 20 Mar 2025 15:57:49 +0100 (CET)
Injection-Info: dont-email.me; posting-host="473358ec40b674de112a7f54c54c8fdc";
	logging-data="3612567"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX183BjS7aLbo4Vx2rjOoEnjacR0YpDC/hpI="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Cancel-Lock: sha1:XF2hUNFg+dHHCOuJ42Qgq19t80A=
Content-Language: en-GB
In-Reply-To: <864izooz0w.fsf@linuxsc.com>
Bytes: 2792

On 20/03/2025 10:02, Tim Rentsch wrote:
> scott@slp53.sl.home (Scott Lurndal) writes:

>> I would disagree with this last statement.  (void)x is genuinely
>> useful and has no ill side effects.   'int a = a;' is exactly
>> the opposite - not useful and has potenial bad side effects.
> 
> I concur except that I recommend using (void)&x rather than (void)x,
> because (void)&x is safer.  If x is volatile qualified, for example,
> the expression (void)x actually does something, and must not be
> compiled away, whereas (void)&x does not have these properties.

I would recommend knowing which variables are volatile and which are 
not, so that the issue does not arise.

Casting a volatile variable to void does "something", but what that 
"something" is is implementation-defined and can vary between compilers. 
  Doing things to volatiles other than clear, simple reads or writes is 
a risk - the semantics are not fully defined in the C standards, 
implementations vary, and it is not at all uncommon for implementations 
to be inconsistent or buggy in that area.  This is why C++ has 
deprecated many uses of volatile objects.  So if you actually want to 
read a volatile variable but ignore the results (as you might well want 
to do for hardware device registers), it's best to do :

	auto dummy = volatile_var;
	(void) dummy;

rather than

	(void) volatile_var;