Deutsch   English   Français   Italiano  
<v97eo3$i03p$2@dont-email.me>

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: Bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: how cast works?
Date: Sat, 10 Aug 2024 11:17:39 +0100
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <v97eo3$i03p$2@dont-email.me>
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>
 <v94smd$mgp8$1@dont-email.me> <v95j4r$qh1q$3@dont-email.me>
 <v95okr$2oa92$1@dont-email.me> <v95sij$1arjo$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 10 Aug 2024 12:17:39 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="a0e251ad936bdebc4e157c2935c3fc38";
	logging-data="589945"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19PIeebzpP0eQ2SlTno+ijs"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:TE94t+b2tkTiR8IzAkNFZhuDTwY=
In-Reply-To: <v95sij$1arjo$3@dont-email.me>
Content-Language: en-GB
Bytes: 2316

On 09/08/2024 21:01, David Brown wrote:
> On 09/08/2024 20:54, Thiago Adams wrote:

> I don't know what you are referring to here.  But if you are using 
> compiler explorer, I encourage you to look at the generated output for a 
> wide range of targets, including 8-bit AVR, 16-bit MSP430, 32-bit ARM, 
> and 64-bit x86.  Use gcc -O1 or -O2 in every case.

When would you choose -O2 over -O1 or vice versa? Could a similar 
circumstance cause you to choose -O0? Why not -O3?

In fact, why is there a -O0 option at all?

   (Ignore Bart's
> ignorant blatherings about optimisation.)

[To TA:]

Yes do. But don't complaint to me when your test code results in 
meaningless or misleading output, or no output at all.

Actually, I would recommend looking at both (eg. -O0 and -O1) so that 
you can see if the compiler's optimiser has been over-zealous in 
eliminating code, or has chopped out key bits, so that you might modify 
your test code.

I would recommend also looking at the Tiny C option on godbolt when 
comparing x86 code.