Xcode 14.2 "new" warnings: Implicit conversion loses integer precision (int to long)

14 views
Skip to first unread message

melcher....@googlemail.com

unread,
Dec 21, 2022, 3:21:29 PM12/21/22
to fltk.coredev

Since I updated Xcode, I get 116 warning for Implicit conversion loses integer precision. Since the other platforms do not get these warning, I'd like to ask for the right procedure: I can verify and add 166 casts from `int` to `long`, or I can disable this particular warning for CMake/Xcode. 

Any opinions?

Xcode 14.2 (clang 14.0.0 for arm64-apple-darwin22.1.0, CMake default settings, Xcode build environment)

Bill Spitzak

unread,
Dec 21, 2022, 3:40:34 PM12/21/22
to fltkc...@googlegroups.com
Since when does casting int to long lose precision????

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/fe85cdea-f2c4-4a61-a00d-1417fc738708n%40googlegroups.com.

Manolo

unread,
Dec 21, 2022, 3:56:09 PM12/21/22
to fltk.coredev
Le mercredi 21 décembre 2022 à 21:40:34 UTC+1, spi...@gmail.com a écrit :
Since when does casting int to long lose precision????

That's because these are casts from long to int, really.

melcher....@googlemail.com

unread,
Dec 21, 2022, 6:26:12 PM12/21/22
to fltk.coredev
Thanks Manolo, yes, long to int, not the other way around.

Manolo

unread,
Dec 22, 2022, 4:42:27 AM12/22/22
to fltk.coredev
Le mercredi 21 décembre 2022 à 21:21:29 UTC+1, Matthias a écrit :

Since I updated Xcode, I get 116 warning for Implicit conversion loses integer precision. Since the other platforms do not get these warning, I'd like to ask for the right procedure: I can verify and add 166 casts from `int` to `long`, or I can disable this particular warning for CMake/Xcode. 

Any opinions?

This looks like the ideal situation to show the usefulness of our new CMP rule allowing static_cast (or whatever it's called).

imm

unread,
Dec 22, 2022, 5:24:49 AM12/22/22
to coredev fltk
On Thu, 22 Dec 2022, 09:42 Manolo wrote:

This looks like the ideal situation to show the usefulness of our new CMP rule allowing static_cast (or whatever it's called).


A simple "long" to "int" cast should be a static_cast, it doesn't need anything fancier.

The generated compiler output should be identical, we're simply telling the compiler that it's as intended.

--
Ian
From my Fairphone FP3
  

Bill Spitzak

unread,
Dec 22, 2022, 12:35:20 PM12/22/22
to fltkc...@googlegroups.com
I agree, just use long(x) or (long)(x) there is no need for the c++ syntax for such simple things.


--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages