[dvblast-devel] tiny bug on platform where char is unsigned

Marian Ďurkovič md at bts.sk
Mon Oct 19 13:07:53 CEST 2009


On Mon, Oct 19, 2009 at 11:59:56AM +0200, HoP wrote:
> Hi Andy
> 
> >> On platform where "char" is unsigned by default, getopt()
> >> ends up with usage() every time because of unsigned casting:
> >
> > Thanks for this, I need to test this won't break parsing on UTF-8 consoles.
> > Getopt is a bit of a pain at times!
> 
> Sure, hehe. But I'm already using console in utf8  mode, so should be
> ok. Another way is to expand "signed char c;" to simple "int c;"
> what skips any casting at all.

I believe we should change it to int. From "man 3 getopt":

SYNOPSIS
       #include <unistd.h>

       int getopt(int argc, char * const argv[],
                  const char *optstring);


   With kind regards,

        M.



More information about the dvblast-devel mailing list