I think your style is not clearer at all. It is not stanard, it uses the assumption that a "p" suffix is a pointer and a "u" prefix is unsigned (although this seems to have caught on with C# people). What does it add over the standard legible method?
I just did this because it was really ugly to have (unsigned char*) and crap everywhere it was more obvious, I was not trying to go according to any standard.
Also, I wanted to type less, I didn't want to have to do something like
Candy wrote:I think your style is not clearer at all. It is not stanard, it uses the assumption that a "p" suffix is a pointer and a "u" prefix is unsigned (although this seems to have caught on with C# people). What does it add over the standard legible method?
QFE.
Your macros adds nothing at all to what the language itself provides mechanisms for. It is simply unnecessary code that creates more problems then good. What significance does your code have over standard C methods?
Its redundant.
nekros wrote:I just did this because it was really ugly to have (unsigned char*) and crap everywhere it was more obvious, I was not trying to go according to any standard.
The best recommendation is to not use casts at all. If you really have casts everywhere, it should point out that the design is flawed. (This is not the case if it is in locations where it is required; not because the data types are different in size)
Last edited by neon on Sat Mar 29, 2008 12:01 pm, edited 1 time in total.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned int DWORD;
typedef unsigned long long int QWORD;
typedef unsigned char UINT8;
typedef unsigned short UINT16;
etc...
This way, the cast doesnt look like a function but is shorter anyway. Furthermore, the exact size got much clearer. Remember that for example the size of "long" depends on weather the compiler is set up for 32 or 64 bit mode.
For the aesthetical question: The capslock looks bad, I know. But not worse than the _t notation. But thats a matter of taste I think
typedef unsigned char byte; /* Byte */
typedef unsigned short word; /* Word */
typedef unsigned int dword; /* Double word */
typedef unsigned long long qword; /* Quad word */