Re: More CppAsString2() in psql's describe.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: More CppAsString2() in psql's describe.c
Date: 2024-11-29 00:51:34
Message-ID: 390757.1732841494@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
> On 28 Nov 2024, at 19:25, Corey Huinker <corey(dot)huinker(at)gmail(dot)com> wrote:
>>> I sort of wish we had a shorter macro as CppAsString2() get's pretty verbose
>>> when used frequently like this.

>> I don't quite understand the etymology of the name (it's some variation on C++'s std::to_string, plus...something), but if I did, I'd probably find the name less icky.

> AFAIK, Cpp stands for "C Pre Processor" as it is a preprocessor expansion into
> a string, and the 2 is simply because CppAsString2() calls CppAsString(). The
> reason for the call is perform macro expansion before converting to string.

Yeah. That name was fine when there were just a few occurrences,
but now it seems we've got hundreds, so +1 for something shorter.

I don't like suggestions as generic as STR() though; that's not very
meaningful and also seems like it might collide with some other usage.
How about something like SYM2LIT ("symbol to literal") or SYM2STR?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2024-11-29 00:56:30 Re: Changing shared_buffers without restart
Previous Message Jim Jones 2024-11-29 00:24:24 Re: Truncate logs by max_log_size