[ / / / / / / / / / / / / / ] [ dir / arepa / asmr / christ / htg / imouto / loomis / magali / maka ][Options][ watchlist ]

/tech/ - Technology

You can now write text to your AI-generated image at https://aiproto.com It is currently free to use for Proto members.
Name
Email
Subject
Comment *
File
Select/drop/paste files here
Password (Randomized for file and post deletion; you may also set your own.)
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Expand all images

File (hide): 483ae3aca10e20f⋯.jpg (20.9 KB, 600x320, 15:8, CQapmmkVEAAreKg.jpg) (h) (u)

[–]

 No.920105>>920120 >>920125 >>925226 >>925284 [Watch Thread][Show All Posts]

What is the difference between unsigned char and byte data types?

They are both a number from 0 to 255

 No.920107>>920113

>byte date type

do you mean std::byte?


 No.920113>>920115 >>925226

>>920107

>std::byte

You don't know what byte data type is?

lol


 No.920115>>920117

>>920113

there is no byte data type

rofl


 No.920117>>920130 >>925226

>>920115

A simple google proves you wrong buddy


 No.920120

>>920105 (OP)

I suppose it's only by convention that a char is always 8 bits long. Maybe one day, the "char" might be synonymous with some 64-bit unicode monstrosity. Remember: ASCII is our ancestral land.


 No.920125

>>920105 (OP)

If i remember correctly char is actually defined as size of one machine native word, which is byte on x86(_64).


 No.920127>>920131

>using unsigned char

>not uint8_t


 No.920130>>920132


 No.920131>>925225

>>920127

>t. edgy leet haxor dude

yea, whatever, you probably never coded in your life


 No.920132>>925990

>>920130

>muh c++

What about Rust?


 No.925212>>925223

Let's see what Common Lisp has to say about it.

>byte n. 1. adjacent bits within an integer. (The specific number of bits can vary from point to point in the program; see the function byte.) 2. an integer in a specified range. (The specific range can vary from point to point in the program; see the functions open and write-byte.)

>character n., adj. 1. n. an object of type character; that is, an object that represents a unitary token in an aggregate quantity of text; see Section 13.1 (Character Concepts). 2. adj. a. (of a stream) having an element type that is a subtype of type character. The most fundamental operation on a character input stream is read-char and on a character output stream is write-char. See binary. b. (of a file) having been created by opening a character stream. (It is implementation-dependent whether this is an inspectable aspect of the file, or whether any given binary file can be treated as a character file.)


 No.925223

>>925212

Just to add on some trivia. LISP Machines didn't actually support a byte datatype. Everything was done in words (eg. 36 bits on the 3600 or 40 bits on the Ivory). Thing like strings were done like arrays and multiple characters were packed into a single word.


 No.925225

>>920131

What? Would you prefer the nonstandard u8 typedef?


 No.925226

File (hide): 4c5680c440c28f3⋯.jpg (47.77 KB, 500x625, 4:5, pathetic.jpg) (h) (u)

>>920105 (OP)

>>920113

>>920117

The absolute state of this 'technology' board.


 No.925231

type Byte is mod 8;
A: Byte := 7;
begin
A: A+1;
Put_Line(A'Image);
end;

= 0


 No.925284

>>920105 (OP)

>What is the difference between unsigned char and byte data types?

One is burned the other bites.


 No.925506>>925518 >>925861

nowadays practically speaking there's no difference, but on some exotic platform char might be more than one byte. Sizes of types in c/c++ like char short and int are platform specific. If you want guaranteed size you have to use uintx_t (where x is the number of bits) but these types might not be implemented on all platforms.

In other words, other than some piece of trivia, a char is a byte today.


 No.925518>>925542

>>925506

no. in C char is one byte on all platforms. It isn't platform defined.


 No.925542>>925563

>>925518

POSIX requires it to be eight bits. The C standard doesn't seem to put any requirements on it besides being an integer capable of containing the basic character set.


 No.925563>>925831

>>925542

Can you name one architecture that uses a 7-bit register?


 No.925831>>925835

>>925563

8 bit byte became standard in the 60s or there about so you have to go back to around these times to find such machines. The computer that was on Apollo mission used 15bit words.


 No.925835>>925861

>>925831

While those are historically fascinating, they do not concern the discussion. Modern hardware addresses 8 bits minimum. This limitation by the hardware available in effect forces the standard to define char as 1 byte. Until 7-bit hardware starts showing up, it is a moot point to argue about such things.


 No.925861>>925862

>>925835

This sub-discussion went roughly like this:

>for all reasonable purposes, chars are eight bits - exotic platforms could theoretically do it differently but that's trivia

<no, it isn't platform-defined

>it actually is platform-defined

I think you're just agreeing with >>925506.


 No.925862>>925863

>>925861

Do those exotic hardware exist?


 No.925863>>925864

>>925862

Of course.


 No.925864>>925865

>>925863

DSP's are weird. That's an arch that addresses other than 8 bits. Took long enough for someone to find a modern example.


 No.925865>>926940

>>925864

>Took long enough for someone to find a modern example.

It took seven minutes from the moment someone first asked for an example. I found it by entering something like "c char size architecture" into a search engine and clicking two links.


 No.925906

Boy, was I disappointed to realize that char was unsigned by default on ARM.


 No.925990


 No.926940

>>925865

I like how char is still 1 byte, but it is also 1 word.




[Return][Go to top][Catalog][Screencap][Nerve Center][Cancer][Update] ( Scroll to new posts) ( Auto) 5
30 replies | 2 images | Page ?
[Post a Reply]
[ / / / / / / / / / / / / / ] [ dir / arepa / asmr / christ / htg / imouto / loomis / magali / maka ][ watchlist ]