Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #43243

Re: wchar_t: signed or unsigned?

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: wchar_t: signed or unsigned?
Date 2014-04-21 11:24 -0700
Organization None to speak of
Message-ID <lnwqeizgkf.fsf@nuthaus.mib.org> (permalink)
References <4cial9tecgiks7ov2q3c1oo53492kvf3ti@4ax.com> <lj3mpr$dml$1@usenet.stanford.edu>

Show all headers | View raw


Seungbeom Kim <musiphil@bawi.org> writes:
> On 2014-04-21 09:55, DSF wrote:
>> Hello, group!
>> 
>>   Is wchar_t signed or unsigned?

Yes.  8-)}

> It can be either.
> You can test it with WCHAR_MIN (defined in <stdint.h>): it shall
> be <= -127 if wchar_t is signed, and 0 if wchar_t is unsigned.
>
>> Is it different in C++ than in C?
>
> Same in C++, despite the difference that it is a distinct type
> defined as a keyword in C++, rather than a typedef name as in C.
>
>> Or is it one of those things left up to the compiler writer?
>
> Yes.
> I don't see it mentioned even as implementation-defined;
> I think it is unspecified.
[...]

It's implementation-defined.

The values of WCHAR_MIN and WCHAR_MAX, macros defined in <stdint.h>, are
explicitly implementation-defined (which means that the implementation
must document them).

See N1570 7.20.3.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

wchar_t: signed or unsigned? DSF <notavalid@address.here> - 2014-04-21 12:55 -0400
  Re: wchar_t: signed or unsigned? Xavier Roche <xroche@free.fr.NOSPAM.invalid> - 2014-04-21 20:02 +0200
  Re: wchar_t: signed or unsigned? Seungbeom Kim <musiphil@bawi.org> - 2014-04-21 11:07 -0700
    Re: wchar_t: signed or unsigned? Keith Thompson <kst-u@mib.org> - 2014-04-21 11:24 -0700
      Re: wchar_t: signed or unsigned? Seungbeom Kim <musiphil@bawi.org> - 2014-04-21 11:57 -0700
        Re: wchar_t: signed or unsigned? James Kuyper <jameskuyper@verizon.net> - 2014-04-21 15:13 -0400
  Re: wchar_t: signed or unsigned? James Kuyper <jameskuyper@verizon.net> - 2014-04-21 14:31 -0400
  Re: wchar_t: signed or unsigned? Stephen Sprunk <stephen@sprunk.org> - 2014-04-21 15:28 -0500
    Re: wchar_t: signed or unsigned? James Kuyper <jameskuyper@verizon.net> - 2014-04-21 16:48 -0400
      Re: wchar_t: signed or unsigned? Keith Thompson <kst-u@mib.org> - 2014-04-21 14:08 -0700
  Re: wchar_t: signed or unsigned? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-04-22 03:21 -0700
    Re: wchar_t: signed or unsigned? Stephen Sprunk <stephen@sprunk.org> - 2014-04-22 10:48 -0500
    Re: wchar_t: signed or unsigned? Keith Thompson <kst-u@mib.org> - 2014-04-22 09:10 -0700
  Re: wchar_t: signed or unsigned? gordonb.8ql82@burditt.org (Gordon Burditt) - 2014-04-23 03:31 -0500
    Re: wchar_t: signed or unsigned? Stephen Sprunk <stephen@sprunk.org> - 2014-04-25 10:00 -0500
      Re: wchar_t: signed or unsigned? Keith Thompson <kst-u@mib.org> - 2014-04-25 09:00 -0700
        Re: wchar_t: signed or unsigned? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-04-25 10:27 -0700
        Re: wchar_t: signed or unsigned? Stephen Sprunk <stephen@sprunk.org> - 2014-04-25 16:43 -0500

csiph-web