Re: Question about ECPGset_noind_null() and ECPGis_noind_null()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Question about ECPGset_noind_null() and ECPGis_noind_null()
Дата
Msg-id 28071.1258659227@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Question about ECPGset_noind_null() and ECPGis_noind_null()  (Boszormenyi Zoltan <zb@cybertec.at>)
Ответы Re: Question about ECPGset_noind_null() and ECPGis_noind_null()
Re: Question about ECPGset_noind_null() and ECPGis_noind_null()
Список pgsql-hackers
Boszormenyi Zoltan <zb@cybertec.at> writes:
>         for (; length > 0 && ptr[--length] == 0xff;);

> I suspect that GCC does the "--length" after checking
> "length > 0" and before checking the "ptr[...] == 0xff",
> but HP CC does it before checking "length > 0".

If it does, that is *unquestionably* a bug in HP's CC and should be
reported to them.  However, the code is sufficiently unreadable to
be worth rewriting anyhow.  Your suggestion is an improvement but
personally I'd plump for
int    i;
for (i = 0; i < length; i++)    if (ptr[i] != 0xff)        return false;return true;
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Boszormenyi Zoltan
Дата:
Сообщение: Re: Question about ECPGset_noind_null() and ECPGis_noind_null()
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: Question about ECPGset_noind_null() and ECPGis_noind_null()