Suspicious warning for fake int in PreviewLoader.cpp
Richard Kimberly Heck
rikiheck at gmail.com
Thu Dec 15 23:48:47 UTC 2022
On 12/15/22 17:02, Stephan Witt wrote:
> Hi all,
>
> I’m seeing this warning with more modern Apple compilers for lyx-2.3.x:
>
> lyx-2.3.x/src/graphics/PreviewLoader.cpp:730:28: warning: result of '2^20' is 22; did you mean '1 << 20' (1048576)? [-Wxor-used-as-pow]
> static atomic_int fake((2^20) + 1);
> ~^~~
> 1 << 20
> lyx-2.3.x/src/graphics/PreviewLoader.cpp:730:28: note: replace expression with '0x2 ^ 20' or use 'xor' instead of '^' to silence this warning
>
> This was fixed in master. Shouldn’t the fix be backport to 2.3.x?
I suppose, but I'm confused. Why is 2^20 = 22? Overflow? Or does ^ not
mean what I thought it did?
Riki
More information about the lyx-devel
mailing list