Hi, thank you for sharing your thoughts, Tobias. On 2020/04/03 21:31 Tobias Heider <tobias.hei...@stusta.de> wrote:
> On Fri, Apr 03, 2020 at 12:52:24AM +0900, Wataru Ashihara wrote: > > It would save our time of thinking and reading the source (i.e. > > eliminate the process of "what if the variable 'mobike' was 2 or more? > > ...aha it's just a bool"). > > > > This is still work in progress. I would continue if you maintainers are > > positive on this proposal. > > Hi, > > i think using bool is not generally a bad idea but I am somewhat sceptical > that the benefits of this really outweight the dangers of introducing new > bugs in otherwise working code. > > Another concern of mine is that I would prefer our codebase to be coherent > in style (which currently means not using <stdbool.h>). Having a coherent > style is pretty important because it allows developers to work in any > part of our code base without changing their habits. > > We have also had discussions about the use of stdbool.h before. Here is a > link a recent one with some more opinions on the topic: > https://marc.info/?l=openbsd-tech&m=157427044406050&w=2 It makes sense to me. Unfortunately clang and gcc can't raise errors about implicit conversion between bool and int. I didn't consider much about introducing new bugs because I've been helped by clang-tidy, which warns about it[1], but not everyone uses it... (at least at this time) [1]: http://clang.llvm.org/extra/clang-tidy/checks/readability-implicit-bool-conversion.html I give up this patch, but I still believe that the self-explanatory type of bool must be informative especially for newbies, so now I hope this style would be proposed as a part of style(9) if compilers implement -Wbool-blah-blah or OpenBSD starts its CI with clang-tidy... > > - Tobias > > Regards, Wataru