Skip to content

is_nan_or_inf gives warning with -Wall -Wextra. #30

Description

@theNoof

compiling a simple program containing jim2.h with the -Wall -Wextra flags, you get this warning:

gcc src/main.c -o target/ndoc -O3 -Wall -Wextra -ggdb
In file included from src/main.c:2:
src/../external/jim2.h: In function ‘is_nan_or_inf’:
src/../external/jim2.h:214:16: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  214 |     return (((*(unsigned long long int*) &x) >> 52ULL) & mask) == mask;
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

(output from the makefile of my project.)

i've tried to google alround for a quick minute and find a solution, but didnt find anything.

for poeple compiling with -Werror, thats a problem. otherwise its just an inconvinience.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions