Re: stringify MAKE_SQLSTATE()

Поиск
Список
Период
Сортировка
От Teodor Sigaev
Тема Re: stringify MAKE_SQLSTATE()
Дата
Msg-id 55AFA6B5.50809@sigaev.ru
обсуждение исходный текст
Ответ на Re: stringify MAKE_SQLSTATE()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
>> #define MAKE_SQLSTATE(ch1,ch2,ch3,ch4,ch5) \
>> ((char[]){(char)(ch1),(char)(ch2),(char)(ch3),(char)(ch4),(char)(ch5),(char)'\0'})
>
> I'm pretty sure that's a gcc-ism, not standard C.
Hmm, after some digging: the feature is called compound literals and it was 
introduced in c99 although gcc has support in c90. To disable this support it's 
needed a flag -pedantic. Sorry.

> The real question is do we want to.  What's your use-case for this?
Just do not have a hardcoded values. It is too easy to make a mistake in 
hardcoded value.




-- 
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
  WWW: http://www.sigaev.ru/
 



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: fdw_scan_tlist for foreign table scans breaks EPQ testing, doesn't it?
Следующее
От: Marti Raudsepp
Дата:
Сообщение: Re: [PATCH] pg_upgrade fails when postgres/template1 isn't in default tablespace