Re: [GD-General] Feedback wanted on POSH
Brought to you by:
vexxed72
|
From: scoubidou944 <sco...@ho...> - 2003-11-19 10:21:31
|
After looking at your var definitions, I'm surprised to see a courageous
developper who can spend time to write long variable type name for basic
types ;p
Many libs (you can see BinkVideo from memory who use it) use this type of
definition :
(the underscore '_' between each parameter name is used to avoid naming
error with local variables overloaded by compiler).
#ifndef IN
#define IN
#endif
#ifndef OUT
#define OUT
#endif
#ifndef OPTIONAL
#define OPTIONAL
#endif
/* BASIC TYPES FOR MULTI PLATEFORM
* char is ALWAYS 8 bits long (plateform independant)
* short is 16 bits long with VISUAL, GNU and PSX2
* int is 32 bits long with VISUAL, GNU and PSX2
* long is 32 bits long with VISUAL, GNU and 64 bits long with PSX2
*/
/* WARNING : this implementation is OK for PSX2 AND VISUAL */
typedef unsigned int u32;
typedef signed int s32;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned char u8;
typedef char s8;
typedef float f32;
typedef double f64;
#ifdef WIN32
#pragma once
typedef unsigned __int64 u64;
typedef signed __int64 s64;
#endif
which can make a prototype simple to read like :
void MyFunction (IN const s32 _s32Int, IN const f32 *_pf32Array, IN OUT f32
*_pf32OutArray, OPTIONAL bool _bWrite);
Using this format, I think every body understand parameters & their use.
Vincent
----- Original Message -----
From: "Garett Bass" <gt...@st...>
To: <gam...@li...>
Sent: Wednesday, November 19, 2003 3:36 AM
Subject: RE: [GD-General] Feedback wanted on POSH
> Brian,
>
> After looking at posh.h I'm a bit confused. You have defined a whole list
> of basic types (posh_..._t), signed and unsigned integers of 8, 16, and 32
> bits respectively. I notice, however, the only platform you support that
> requires these typedefs is PalmOS, and then only for the 32-bit integers.
>
> This seems like overkill, especially considering the duplication of
> integer/signed types. This leaves me wondering whether some platforms
> define char as unsigned char while others define char as signed char. Why
> not simply define posh types based on the number of bits and leave the
> signed/unsigned up to the user? For example:
>
> typdef char my_byte;
> void Foo(unsigned my_byte bar) {/*...*/};
>
> Also, I find it misleading to call an unsigned char a "byte", since all of
> the char types are technically a byte and your posh "byte" has no
intrinsic
> indication of being unsigned. Also, having the same signed type appear
> under two different names may leave the user wondering whether there is a
> need to explicitly convert a variable of type i16 to s16, which serves no
> purpose.
>
> Grandmaster B, I seek enlightenment on these matters, would you mind
> explaining your reasoning?
>
> Regards,
> Garett Bass
> gt...@st...
|