On Wed, Feb 5, 2020 at 10:56 AM Tom Lane <t...@sss.pgh.pa.us> wrote: > > Doesn't the proposed magic number address this concern? > > No, because (a) it will be a random magic number that nobody will > remember, and gdb won't print in any helpful form; (b) at least > as I understood the proposal, there'd be just one magic number for > all types of memory context.
I don't disagree with the factual statements that you are making but I don't understand why any of them represent real problems. - It's true that magic numbers are generally not chosen for easy memorization, but I think that most experienced hackers don't have much trouble looking them up with 'git grep' on those (generally rare) occasions when they are needed. - It's true that gdb's default format is decimal and you might want hex, but it has a 'printf' command that can be used to do that, which I at least have found to be pretty darn convenient for this sort of thing. - And it's true that I was proposing - with your agreement, or so I had understood - one magic number for all context types, but that was specifically so you could tell whether you had a memory context or some other thing. Once you know it's really a memory context, you could print cxt->methods->name. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company