[sane-devel] typedef int SANE_Word, etc

Alessandro Zummo azummo-lists at towertech.it
Wed Dec 3 20:18:31 UTC 2008


On Wed, 3 Dec 2008 04:53:24 +0300
ABC <abc at telekom.ru> wrote:

> Btw, what the point of having these typedefs?
> (Besides obscurity and advertising of course).
> 
> > typedef unsigned char  SANE_Byte;
> > typedef int  SANE_Word;
> > typedef SANE_Word  SANE_Bool;
> > typedef SANE_Word  SANE_Int;
> > typedef char SANE_Char;
> > typedef SANE_Char *SANE_String;
> > typedef const SANE_Char *SANE_String_Const;
> > typedef void *SANE_Handle;
> > typedef SANE_Word SANE_Fixed;
> 
> > sane-backends/include/sane/sane.h:42

 I think they were defined to have a set of
 types with known size, useful when you are passing
 structures to the hardware (a very bad practice!!!!)
 and for networking (bad too, you should never make assumptions
 on types for those things).

 Now that we have ANSI C types for everything,
 it might be useful to switch.

 void *SANE_Handle is used to pass an opaque
 pointer and should be retained.

 SANE_Char and SANE_String could easily go away,
 along with SANE_Byte. For the others a little bit
 of attention is required.

 I doubt anyone else, except me, is interested in doing so
 anyway :)

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it




More information about the sane-devel mailing list