News for hackers. Stuff that matters.
Re:A Regular Expression Matcher (2007) by ridiculous_fish on Thursday August 25, 2022 @03:55AM (#32590876)
Why in matchstar does c have type int instead of char? Is this some holdover from K&R C?
Re:A Regular Expression Matcher (2007) by eesmith on Thursday August 25, 2022 @08:50AM (#32593020)
Interesting. I see elsewhere that "int" is used where "char" should be fine, specifically, "int sepc" on page 97 of https://archive.org/details/practiceofprogra0000kern/page/96... , used only for a (char*)[0] and a test against ','.

While the C++ code on page 101 at https://archive.org/details/practiceofprogra0000kern/page/10... uses a "char c" parameter.

There's also some "unsigned char c" at pages 169 and 170, at https://archive.org/details/practiceofprogra0000kern/page/16... , in C code.

I'm going to guess it's from habit of using "int c" with getchar() to prevent confusion between EOF (-1) and 255. Discussed at https://archive.org/details/practiceofprogra0000kern/page/19... .