From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org, "Andrew Dunstan" <andrew(at)dunslane(dot)net> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: [HACKERS] psql commandline conninfo |
Date: | 2006-12-16 15:38:40 |
Message-ID: | 29216.1166283520@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
"Andrew Dunstan" <andrew(at)dunslane(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-12-16 16:14:02 | Re: Operator class group proposal |
Previous Message | Tom Lane | 2006-12-16 15:26:52 | Re: invalid input syntax for type timestamp. |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2006-12-17 03:47:33 | Re: [HACKERS] psql commandline conninfo |
Previous Message | Andrew Dunstan | 2006-12-16 13:11:09 | Re: [HACKERS] psql commandline conninfo |