Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is a char? #2

Open
archer884 opened this issue Aug 30, 2016 · 1 comment
Open

What is a char? #2

archer884 opened this issue Aug 30, 2016 · 1 comment

Comments

@archer884
Copy link

With the proliferation (if I think of a word that sounds more like how a disease spreads, I'll edit this) of unicode, it's become pretty common for new languages to make allowances for unicode strings, or to use unicode strings natively. In both cases, a character is a pretty strange type--and often we're talking about something that is 16 or 32 bits wide. This isn't the case in C++. I actually don't know off the top of my head what a character in C++ is (I think it's an 8-bit value representing... ascii?), so I think that (for experienced programmers, anyway) it might be good to mention that in passing.

@19h
Copy link

19h commented Aug 6, 2017

A char is a byte -- that is, 8 bit. However, by way of ASCII, "character" did, in fact, inspire the naming of "char."

The more important point of confusion is the size of int / uint, because they are only defined as at least values, leaving compilers with the freedom to determine the sizes at will. (i.e. int can be 4 bytes, but also 2 bytes; sometimes it's also a 64bit value -- 8 bytes. That way you are nearly always forced to determine sizes using sizeof.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants