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

Αρχική Σελίδα
Delete this message
Συντάκτης: Philip Hazel
Ημερομηνία:  
Προς: pcre-dev
Παλιά Θέματα: [pcre-dev] [Bug 1049] New: Add support for UTF-16
Αντικείμενο: [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




--- Comment #27 from Philip Hazel <ph10@???> 2011-11-16 16:27:58 ---
On Wed, 16 Nov 2011, Petr Pisar wrote:

> --- Comment #26 from Petr Pisar <ppisar@???> 2011-11-16 08:51:18 ---
> (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!

Regards,
Philip


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