Peter Moulder wrote:
[that POSIX/SUS requires that <stdint.h> define WCHAR_MAX]
Axel Liljencrantz replied:
[that ISO C requires that <wchar.h> define WCHAR_MAX].

Both standards actually specify that both headers define WCHAR_MAX (this isn't the only identifier defined in multiple headers).

[...]
Peter Moulder also wrote:
As a workaround if stdint.h isn't enough, you can try

  find /usr/include -name '*.h' -type f -print | xargs grep WCHAR_MAX

to see if it's defined somewhere else.

If all else fails, add the following to common.c, after all the #include
lines:

  #ifndef WCHAR_MAX
  # define WCHAR_MAX 0x7fffffff
  #endif

Note that max_val is of type int.  The above assumes that wchar_t and
int are both at least 32 bits.

It would be safer (but not 100% safe) to use INT_MAX than 0x7fffffff. This requires no 32-bit assumption.

INT_MAX is defined in limits.h.

(I'm not sure though what you're referring to by max_val and why its type is int)

Axel Liljencrantz replied:
That's kind of hard to work around, since WCHAR_MAX needs to be known
at runtime, so you can't use any clever sizeof-based tests.

I'm not sure what you mean here. The result of sizeof can be relied on at runtime - isn't that one reason why we recompile for different architectures? (in this case sizeof seems to be an unsafe option though)

In other
words, one would have to use an Autoconf test. But I'm lazy, so I'll
settle for assuming 32-bit:ness, since this is just a bug-workaround.

Using INT_MAX assumes int:ness instead of 32-bit:ness. It's still not ideal though - for one because legally a wchar_t could be a short or a char.

[...]
--
http://members.dodo.com.au/~netocrat


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to