Skip to content

gcc9 complaining about comparison between pointer and zero character constant #44

@mjtrangoni

Description

@mjtrangoni

Hi @cavaliercoder,

gcc[1] reports this warning,

libzbxsystemd.c: In function ‘SYSTEMD_UNIT_DISCOVERY’:
libzbxsystemd.c:214:35: warning: comparison between pointer and zero character constant [-Wpointer-compare]
  214 |         if(NULL != filter || '\0' != filter)
      |                                   ^~
libzbxsystemd.c:214:38: note: did you mean to dereference the pointer?
  214 |         if(NULL != filter || '\0' != filter)
      |                                      ^

Why do you need to check that in parallel to the correspondent NULL?

[1] gcc (GCC) 9.3.1 20200317 (Red Hat 9.3.1-1)

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