Actually, most C implementations use a 4 byte integer, but it's not universally so. IIRC, the C standard calls for the following bit widths:
char - 8 bits
w_char - 16 bits (this may be C++ only)
short int - at least 16 bits but no more than 32 bits
int - no less than the system implementation of short, but no more than the system implementation of long; usually 32 bits
in modern implementations
long int - at least 32 bits but no more than 64 bits
long long int - at least 64 bits
float - 32 bits
double - 48 or 64 bits
long double or double double - 96 bits
complex - the size of two ints (I think; this type as only introduced in the latest C standard, and AFAIK is
not in C++)
I'm not entirely sure of this, as I have not seen the most recent standard; this is entirely from memory, as well. I am sure that Solar and others caan correct any errors I've made, for which I would be quite grateful.
In any case, there is simply no need for a peek() or poke() function in either C or assembly; in assembly, you can simply use 'mov AX,
address' or the appropriate equivalent, while in C (assuing protected mode on the x86) you can simply cast the integer value of the address to the appropriate pointer type. To take an example from a real world case:
Code: Select all
char* text_page_0;
text_page_0 = (char*) 0xB8000; /* the beginning of the first text video page */
Perhaps it would help if you explained what you were trying to access, and why you wanted to use those functions to do so.