Re: [HACKERS] psql commandline conninfo
От | Tom Lane |
---|---|
Тема | Re: [HACKERS] psql commandline conninfo |
Дата | |
Msg-id | 29216.1166283520@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: [HACKERS] psql commandline conninfo ("Andrew Dunstan" <andrew@dunslane.net>) |
Список | pgsql-patches |
"Andrew Dunstan" <andrew@dunslane.net> writes: > BTW, what is the approved way to handle warnings about const? Copy the > object? Well, in the revised code there shouldn't be any warning at all, but I think the mistake in your original was to declare the local variable as "char *" instead of "const char *". If "const" is being used as intended then a const-violation warning would indeed suggest that you needed to make a writable copy. Sometimes the problem is that you're working in a chunk of inadequately const-ified code, ie, you're passing a const argument to some other functions that do indeed treat their inputs as read-only but don't declare them const. In such cases you can either run around and try to inject const everywhere it should be, or hold your nose and use a cast, or give up on marking your own argument const :-(. But you weren't presented with that problem here, because connectOptions1() is already const-ified. regards, tom lane
В списке pgsql-patches по дате отправления: