Re: [HACKERS] stringify MAKE_SQLSTATE()

2015-07-22 Thread Teodor Sigaev
#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 suppor

Re: [HACKERS] stringify MAKE_SQLSTATE()

2015-07-22 Thread Tom Lane
Teodor Sigaev writes: > Following discussion at https://commitfest.postgresql.org/5/190/ patch, I > found > (at seems to me) a way to stringify MAKE_SQLSTATE(), the idea is to use char > array as string: > #define MAKE_SQLSTATE(ch1,ch2,ch3,ch4,ch5) \ > ((char[]){(char)(ch1),(char)(ch2),(char)(

[HACKERS] stringify MAKE_SQLSTATE()

2015-07-22 Thread Teodor Sigaev
Hi! Following discussion at https://commitfest.postgresql.org/5/190/ patch, I found (at seems to me) a way to stringify MAKE_SQLSTATE(), the idea is to use char array as string: #include #define MAKE_SQLSTATE(ch1,ch2,ch3,ch4,ch5) \ ((char[]){(char)(ch1),(char)(ch2),(char)(ch3),(char)(ch4),