[PATCH] Fix wchar_t constant strings (was Re: wchar_t constant not possible)

Andreas Jaeger aj@suse.de
Tue Sep 12 02:35:00 GMT 2000


>>>>> Jakub Jelinek writes:

 > Hi!
 > The following patch restores the old gcc behaviour where the string is
 > stored properly (e.g. on ia32 as .string "f"; .string ""; .string ""; .string ""
 > etc.), but still fails (this test seems to fail with e.g. 0731 snapshot as
 > well), I'll track that other bug soonish.
Thanks Jakub.

[...]

 > BTW: You might want to change this to:
 >   if (ws[0] != L'f' || ws[1] != L'o' || ws[2] != L'o' || ws[3] != L'\0')
 >     abort();
 >   exit(0);

I've changed it now to:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <stddef.h>

const wchar_t ws[] = L"foo";

int
main (void)
{
  if (ws[0] != L'f' || ws[1] != L'o' || ws[2] != L'o' || ws[3] != L'\0')
    abort();
  exit(0);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Shall I commit this one?

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


More information about the Gcc-patches mailing list