From: Andrew Dunstan on


Tom Lane wrote:
> I grow weary of mopping up after pgindent, as in
> http://archives.postgresql.org/pgsql-committers/2010-07/msg00069.php
>
> The problem evidently is that pgindent hasn't heard of wide character
> constants. No doubt the best fix would be to teach it about them;
> but given that we seem to have next to no use for such constants,
> I'm dubious that it's worth the trouble. I suggest that it might be
> best to replace these usages of L'\0' by plain scalar 0. Does anyone
> think that wouldn't work or is too grotty?
>
>
>

or maybe 0x0000, which I gather from
<http://en.wikipedia.org/wiki/Wide_character> is the usual locution.

cheers

andrew.

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Tom Lane on
Andrew Dunstan <andrew(a)dunslane.net> writes:
> Tom Lane wrote:
>> I'm dubious that it's worth the trouble. I suggest that it might be
>> best to replace these usages of L'\0' by plain scalar 0. Does anyone
>> think that wouldn't work or is too grotty?

> or maybe 0x0000, which I gather from
> <http://en.wikipedia.org/wiki/Wide_character> is the usual locution.

Hm. I don't really read that page as suggesting that 0x0000 is what to
use if your compiler hasn't got wide chars. I'd tend to go with just 0,
which is a reasonably common substitute for non-wide '\0' ...

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Takahiro Itagaki on

Tom Lane <tgl(a)sss.pgh.pa.us> wrote:

> >> I'm dubious that it's worth the trouble. I suggest that it might be
> >> best to replace these usages of L'\0' by plain scalar 0.
> I'd tend to go with just 0,
> which is a reasonably common substitute for non-wide '\0' ...

I think all of the following codes work in the same way
at least on Windows, where the codes are actually used.

utf16[dstlen] = L'\0';
utf16[dstlen] = '\0';
utf16[dstlen] = 0;
utf16[dstlen] = (WCHAR) 0;

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center



--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Tom Lane on
Takahiro Itagaki <itagaki.takahiro(a)oss.ntt.co.jp> writes:
> I think all of the following codes work in the same way
> at least on Windows, where the codes are actually used.

> utf16[dstlen] = L'\0';
> utf16[dstlen] = '\0';
> utf16[dstlen] = 0;
> utf16[dstlen] = (WCHAR) 0;

The last one seems like the best choice, since it makes the intent visible.
Committed that way --- thanks for the suggestion!

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers