`byte' typedef?

Werner Koch wk@gnupg.org
Mon Jul 1 09:36:01 2002


On Wed, 12 Jun 2002 14:04:07 -0500, David Champion said:

> I was cleaning these up when I realized that the use of "byte" types was
> intentional. What's the reasoning for this? What would be the preferred

In general I believe that unsigned char* makes much more sense than a
signed char.  However most Posix function expect char * and most
compilers default to signed for char.  One major problem I encountered
over the years are C libs not implementing the isfoo() suite correctly
(e.g. HPUX).  So you have to use either unsigned char * or cast to
that before using any of these functions or you will pretty sure get a
SEGV.

> where it didn't appear to matter whether they were unsigned, but perhaps
> casts are preferred?

casts are only required very rarely today since we now have the void*.

>From the gcc manual:

   * Warning about assigning a signed value to an unsigned variable.

     Such assignments must be very common; warning about them would
     cause more annoyance than good.

I have seen some compilers with an option to suppress these warnings.


Shalom-Salam,

   Werner