May 16, 2024, 12:23:57 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Data Types

Started by Zen, January 06, 2006, 09:19:24 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zen

I have just seen in the Winsock.h file that there is and "unsigned char" data type. for Aurora to use char it is an "unsigned byte". How would we use "unsigned char"? im guessing its not "unsigned unsigned byte" ;)

Lewis

Zen

Nevermind i managed to find it in the SDK. so for anyone else wondering, an unsigned char is just a byte. Maybe that was obvious for others but not for me.

Lewis

GWS

He .. He .. :)ÂÃ,  the only negative character I ever came across was a human kind ..

Graham :)
Tomorrow may be too late ..

Ionic Wind Support Team

unsigned char = unsigned byte
char  = byte

Although I prefer char = unsigned byte.
Ionic Wind Support Team

Zen

ohh. i have been using unsigned byte as char. not just byte. Maybe that is the problem i am having with my MD5 hash algorithm. hmm. worth a try.

Lewis

Parker

In hashing it's really picky if the operations depend on what the sign bit is being used for. In standard ASCII text, they only use 7 bits to designate the text, so either would work for normal text, but there are some times when you have to be careful with it.

In C anything can be signed or unsigned, with the default left up to the writer of the compiler. So signed char is the same as byte in Aurora, signed int is the same as int, unsigned int is the same in Aurora, etc. Just for reference, short = word, long = a 32 bit quantity, I think int may vary based on whether or not the system is 32 or 64 bit. __int64 is always 64 bit in microsoft compilers at least, float and double are the same, they can't have the signed or unsigned prefix. I think long long is also 64 bit, and there's a long double too, which I think is 10 byte, but I may be wrong.

Ionic Wind Support Team

float = 32 bit
double = 64 bit

In both aurora and C
Ionic Wind Support Team

Parker

January 06, 2006, 03:51:18 PM #7 Last Edit: January 06, 2006, 03:53:04 PM by Parker
I guess I wasn't very clear on that, I meant to say that they had the same type names in both languages, not that they were the same type. Sorry

And then the Intel compiler has all kinds of weird datatypes for MMX, SSE, etc. But that's all confusing for me.

John S

still a bit confused (maybe not) - tried for an hour to get a little program to run until I found out that the data type "char" is not available.

Am I correct in my reading of this forum thread that:

char = unsigned byte   (is there a signed byte and if so, does a signed byte = char, I don't think so)

float = 32 bit  (4 byte) ?
double = 64 bit  (8 byte) ?
John Siino, Advanced Engineering Services and Software

Parker

In C there are no rules on whether a type defaults to signed or unsigned, so they have both of those keywords for you to distinguish. In Aurora they are all signed unless you specify unsigned.

Since an ASCII character normally only uses 7 bits (there are some 8 bit systems though), it shouldn't matter too much whether you use byte or unsigned byte. But I always use unsigned byte.

Yes, float is 32 bit and double is 64 bit.