public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Warn about conversion from floating point to integers
@ 2022-08-20  9:21 Andrea Bocci
  2022-08-22 17:32 ` Segher Boessenkool
  0 siblings, 1 reply; 7+ messages in thread
From: Andrea Bocci @ 2022-08-20  9:21 UTC (permalink / raw)
  To: gcc-help

Hi,

is there a way to ask GCC to produce a warning when there is a conversion
from a floating point type (float or double) to an integer type (char,
short, int, long, etc.), but not when there is a conversion from double to
float ?

The reason is that we often do computations in double precision and store
the result in single precision, so I'd rather not warn about that.

-Wconversion warns about both kinds and more.
-Wfloat-conversion warns about both kinds.

Thank you for any advice,
.Andrea

-- 

Dr. Andrea Bocci
Applied Physicist, CMS Experiment
<https://cms.cern/>EP-CMD, CERN
<https://home.cern/>168990 (+41 75 411 8990)
CERN 40/1-B01 <https://maps.cern.ch/mapsearch/mapsearch.htm?n=['40/1-B01']>
E27810

Esplanade des particules, 1, CH-1211 Geneve 23, Switzerland
<https://goo.gl/maps/AMjHdhXzYk2itSu7A>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-08-22 23:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-20  9:21 Warn about conversion from floating point to integers Andrea Bocci
2022-08-22 17:32 ` Segher Boessenkool
2022-08-22 19:27   ` Andrea Bocci
2022-08-22 19:43     ` Jonathan Wakely
2022-08-22 19:48       ` Andrea Bocci
2022-08-22 23:01         ` Segher Boessenkool
2022-08-22 23:39           ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).