bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dfa - gawk matching problem on windows and suggested fix


From: Eli Zaretskii
Subject: Re: dfa - gawk matching problem on windows and suggested fix
Date: Mon, 03 Oct 2011 18:27:14 +0200

> From: Jim Meyering <address@hidden>
> Cc: address@hidden,  address@hidden
> Date: Mon, 03 Oct 2011 13:27:12 +0200
> 
> > I get a negative value for 0x95 from `lex'.  An explicit `fprintf'
> > after this line:
> >
> >             (c) = wctob(wc);
> >
> > shows that the value of `c' is -107.  The value returned by wctob, if
> > printed using %d is -107, and if printed with %x, shows as 0xffffff95.
> 
> That shows the problem is with the Windows wctob implementation.

What is the problem with it?

> What if you include something like this just above?
> (this is part of gnulib's wctob replacement, lib/wctob.c)

This version of wctob solves the problem.  But I'd still like to
understand what is wrong with stock wctob, as the references I
consulted don't say the result must be positive.  E.g., this:

  http://pubs.opengroup.org/onlinepubs/007904875/functions/wctob.html

says

  The wctob() function shall return EOF if c does not correspond to a
  character with length one in the initial shift state. Otherwise, it
  shall return the single-byte representation of that character as an
  unsigned char converted to int.

Does "unsigned char converted to int" necessarily say that the result
must be positive?  Or am I missing something?

Thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]