Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Unsigned and signed char types

Reply
Thread Tools

Unsigned and signed char types

 
 
Sriniv
Guest
Posts: n/a
 
      06-12-2005
Hello all,
Do we have unsigned and signed char types? If so, i'd like to know the
differences between the two.
And one more question. Is there any provision in C for using the
Unicode character set?
Thank you.
-- Srinivasan.

 
Reply With Quote
 
 
 
 
Emmanuel Delahaye
Guest
Posts: n/a
 
      06-12-2005
Sriniv wrote on 12/06/05 :
> Do we have unsigned and signed char types?


Yes, there are 3 char= types:

char : used for strings

signed char
and
unsigned char : used for small integers (mainly in arrays).

> If so, i'd like to know the
> differences between the two.


For the signed/unsigned types, the difference is the range and the
behaviour on overflow. More details in your C-book.

http://publications.gbdirect.co.uk/c_book/ (C90)

> And one more question. Is there any provision in C for using the
> Unicode character set?


Yes, the C95 wchar_t type and related w*() functions.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

..sig under repair

 
Reply With Quote
 
 
 
 
Ben Pfaff
Guest
Posts: n/a
 
      06-12-2005
"Emmanuel Delahaye" <(E-Mail Removed)> writes:

> Yes, there are 3 char= types:
>
> char : used for strings [...]


It is certainly true that `char' is the type most often used for
strings. However, the C standard doesn't restrict the definition
of "string" to `char' only:

7.1 Introduction
7.1.1 Definitions of terms
1 A string is a contiguous sequence of characters terminated by
and including the first null character.

This may or may not be useful to know outside of comp.lang.c.
--
Ben Pfaff
email: http://www.velocityreviews.com/forums/(E-Mail Removed)
web: http://benpfaff.org
 
Reply With Quote
 
Lawrence Kirby
Guest
Posts: n/a
 
      06-12-2005
On Sun, 12 Jun 2005 20:11:39 +0200, Emmanuel Delahaye wrote:

> Sriniv wrote on 12/06/05 :
>> Do we have unsigned and signed char types?

>
> Yes, there are 3 char= types:
>
> char : used for strings
>
> signed char
> and
> unsigned char : used for small integers (mainly in arrays).
>
>> If so, i'd like to know the
>> differences between the two.

>
> For the signed/unsigned types, the difference is the range and the
> behaviour on overflow. More details in your C-book.


As such they are like other signed and unsigned integer types.

> http://publications.gbdirect.co.uk/c_book/ (C90)
>
>> And one more question. Is there any provision in C for using the
>> Unicode character set?

>
> Yes, the C95 wchar_t type and related w*() functions.


Even C89 has some wide character support. Note that as with normal
charcters the character encoding is not specified so it need not be
Unicode.

Lawrence

 
Reply With Quote
 
William Ahern
Guest
Posts: n/a
 
      06-13-2005
Sriniv <(E-Mail Removed)> wrote:
> Hello all,
> Do we have unsigned and signed char types? If so, i'd like to know the
> differences between the two.
> And one more question. Is there any provision in C for using the
> Unicode character set?


FWIW, Unicode isn't simply a "character set". It's a whole set of rules and
methodologies. C in it's C99 incarnation is about as close to supporting
Unicode as it was when Unix was rewritten in C 30 years ago.

Some will mention wchar_t and the new wide character functions. But wchar_t
gives you absolutely zilch, no matter whether it's 16-bits or 32-bits or
128-bits. The char type suffices just as well, because no matter the width
of the type you _still_ have combining characters, so the whole notion of
mapping a glyph (the things you see on your screen) to a "character" is long
dead, particularly with regards to Unicode.

So, depending on your disposition C either has no support for Unicode, or it
supports it just fine. IOW, you can use libraries like IBM's ICU to deal w/
Unicode. I doubt C will ever have the type of "support" for Unicode like,
for instance, Java has. Though it's worth mentioning that arguably Java got
it wrong. Which is why C will never have that type of support; there's no
single way to do it, and it's quite application specific.

- Bill
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Padding bits and char, unsigned char, signed char Ioannis Vranos C Programming 6 03-29-2008 10:55 AM
Padding bits and char, unsigned char, signed char Ioannis Vranos C++ 11 03-28-2008 10:47 PM
char vs. signed or unsigned char At_sea_with_C C Programming 4 03-14-2007 08:28 PM
void*, char*, unsigned char*, signed char* Steffen Fiksdal C Programming 1 05-09-2005 02:33 AM
signed char and unsigned char difference dam_fool_2003@yahoo.com C Programming 9 07-26-2004 01:59 AM



Advertisments