Re: [HACKERS] Does mbutils.c really need to use L'\0' ?

2010-07-07 Thread Tom Lane
Takahiro Itagaki itagaki.takah...@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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Does mbutils.c really need to use L'\0' ?

2010-07-06 Thread Tom Lane
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?

regards, tom lane

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


Re: [HACKERS] Does mbutils.c really need to use L'\0' ?

2010-07-06 Thread Andrew Dunstan



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 0x, 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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Does mbutils.c really need to use L'\0' ?

2010-07-06 Thread Tom Lane
Andrew Dunstan and...@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 0x, 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 0x 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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Does mbutils.c really need to use L'\0' ?

2010-07-06 Thread Takahiro Itagaki

Tom Lane t...@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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers