IonicWind Software

Aurora Compiler => General Discussion => Topic started by: Zen on January 06, 2006, 09:19:24 AM

Title: Data Types
Post by: Zen on January 06, 2006, 09:19:24 AM
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
Title: Re: Data Types
Post by: Zen on January 06, 2006, 09:41:49 AM
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
Title: Re: Data Types
Post by: GWS on January 06, 2006, 09:57:57 AM
He .. He .. :)ÂÃ,  the only negative character I ever came across was a human kind ..

Graham :)
Title: Re: Data Types
Post by: Ionic Wind Support Team on January 06, 2006, 01:03:33 PM
unsigned char = unsigned byte
char  = byte

Although I prefer char = unsigned byte.
Title: Re: Data Types
Post by: Zen on January 06, 2006, 02:25:56 PM
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
Title: Re: Data Types
Post by: Parker on January 06, 2006, 03:19:33 PM
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.
Title: Re: Data Types
Post by: Ionic Wind Support Team on January 06, 2006, 03:32:23 PM
float = 32 bit
double = 64 bit

In both aurora and C
Title: Re: Data Types
Post by: Parker on January 06, 2006, 03:51:18 PM
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.
Title: Re: Data Types
Post by: John S on January 14, 2006, 10:01:26 PM
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) ?
Title: Re: Data Types
Post by: Parker on January 14, 2006, 10:08:46 PM
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.