4 ms·
Like what C did with bool? Ick. Gross. Ugly. Me no like. I understand why they did that in this case: by the time they got around to fixing the lack of boo
by marvy 11y ago
Like what C did with bool? Ick. Gross. Ugly. Me no like. I understand why they did that in this case: by the time they got around to fixing the lack of bool, they had to work around everyone else's workarounds! But that was an extreme case. Let's not do that more often than we must.
- cpeterso 11y agoI assume the authors of the C standard expected developers to typedef their C project's existing bool or BOOL types to _Bool. There is also a stdbool.h header that defines macros for bool (_Bool), true (1), and false (0).
- mikeash 11y agoI like it. It effectively adds a new keyword to the language that's only available if you include a header. The technique isn't pretty, but the result is pretty nice IMO.
- marvy 11y agoBut I don't want to include a header just to use bool. I'm willing to include a header for big things (like strcmp), but bool is such a small convenience that it should be available without an include, because otherwise it's less work to just use an int than to go to the top of the file and add an include. Plus, I think the idea of putting each keyword behind an include gets annoying if you do this for a significant fraction of your keywords. (It's neat that you can, but... should you?) For instance, imagine if throw, class, and protected were all behind separate includes?