Re: stringify MAKE_SQLSTATE() - Mailing list pgsql-hackers

From Teodor Sigaev
Subject Re: stringify MAKE_SQLSTATE()
Date
Msg-id [email protected]
Whole thread Raw
In response to Re: stringify MAKE_SQLSTATE()  (Tom Lane <[email protected]>)
List 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: [email protected]
  WWW: http://www.sigaev.ru/
 



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: fdw_scan_tlist for foreign table scans breaks EPQ testing, doesn't it?
Next
From: Marti Raudsepp
Date:
Subject: Re: [PATCH] pg_upgrade fails when postgres/template1 isn't in default tablespace