ecpg compiler warning about char* comparison - Mailing list pgsql-hackers

From Takahiro Itagaki
Subject ecpg compiler warning about char* comparison
Date
Msg-id 20100308104602.9C53.52131E4D@oss.ntt.co.jp
Whole thread Raw
Responses Re: ecpg compiler warning about char* comparison
List pgsql-hackers
There is a complier warning in ecpg/ecpglib/error.c on HEAD:

error.c: In function 'eecpg_raise_backend':
error.c:309: warning: comparison with string literal results in unspecified behavior

It comes from the following coparison:
---
#define ECPG_SQLSTATE_ECPG_INTERNAL_ERROR    "YE000"
char       *sqlstate;
if (sqlstate == ECPG_SQLSTATE_ECPG_INTERNAL_ERROR)
---

Instead, should we use "if (strcmp(...) == 0)" here?

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Re: incorrect exit code from psql with single transaction + violation of deferred FK constraint
Next
From: fanng yuan
Date:
Subject: arithmetic about inet