[pcre-dev] [Bug 1049] Add support for UTF-16

Top Page
Delete this message
Author: Petr Pisar
Date:  
To: pcre-dev
Old-Topics: [pcre-dev] [Bug 1049] New: Add support for UTF-16
Subject: [pcre-dev] [Bug 1049] Add support for UTF-16
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1049

Petr Pisar <ppisar@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppisar@???





--- Comment #28 from Petr Pisar <ppisar@???> 2011-11-16 16:58:36 ---
(In reply to comment #27)
> On Wed, 16 Nov 2011, Petr Pisar wrote:
> > (In reply to comment #20)
> > > static const union { int i; char c; } order = { 1 }; /* initialisation assigns
> > > first union member */
> > >
> > > You can then simply check:
> > >
> > > if (order.c == 1) {
> > >    /* little endian */
> > > } else {
> > >    /* big endian */
> > > }

> > >
> > This wrongly assumes sizeof(int) != sizeof(char) and that both of them are
> > signed or unsigned.
>
> True. I guess one could test for sizeof(unsigned int) == sizeof(unsigned
> char) and then try sizeof(unsigned long int) == sizeof(unsigned char)
> and if that is also true, give up!
>

If you required POSIX or c99, then you could include <stdint.h> and use uint8_t
and uint16_t types.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email