"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: got patch: add flag to ignore whitespace?
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 03 Jul 2022 15:31:15 +0200

Download raw body.

Thread
  • Mark Jamsek:

    got patch: add flag to ignore whitespace?

  • Christian Weisgerber <naddy@mips.inka.de> wrote:
    > Stefan Sperling:
    > 
    > > Actually, all the ctype functions need a cast to unsigned char, like
    > > this: isspace((unsigned char)ch);
    > > 
    > > I don't recall why, but there was a sweep throughout the entire
    > > OpenBSD tree at some point to add such casts.
    > 
    > The is*() functions take an int argument, which may have the value
    > of any char and additionally EOF.  The idea seems to be that you
    > can feed the return value of, say, getchar() to is*().
    > 
    > On architectures like x86 where char is signed by default, passing
    > a char to an int parameter will sign-extend the value.  In particular,
    > a char with value 0xff will turn into 0xffffffff, which is -1, which
    > is typically the value of EOF.  Oops.
    
    woops, I see the issue now.  Thanks for the clarification! :)
    
    
    
  • Mark Jamsek:

    got patch: add flag to ignore whitespace?