ecpg compiler warning about char* comparison

From: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: ecpg compiler warning about char* comparison
Date: 2010-03-08 01:46:03
Message-ID: 20100308104602.9C53.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message fanng yuan 2010-03-08 01:47:00 arithmetic about inet
Previous Message Bruce Momjian 2010-03-08 00:47:42 Re: Re: incorrect exit code from psql with single transaction + violation of deferred FK constraint