Hi Stefan, On Sonntag, 19. November 2017 23:07:43 CET Stefan Fuchs wrote: > Am 18.11.2017 um 19:40 schrieb Berthold Stoeger: > >> [...] > >> In fact, even when you can depend on a modern compiler, it's usually > >> best to restrict "bool" use entirely to just function return values > >> and very local use. > > > > I figure pref.h counts as such a local use, because it is purely an > > application-internal thing? Or would you prefer going the short (or char?) > > route? > > > > bool certainly has the advantage of correctly expressing intent in this > > case. There are short members in pref.h which actually do represent > > integer values. > May I ask you s.th. mainly to learn s.th.: > I also once added a feature with an additional prefs option where I > would have preferred the new variable to be a bool. The variable is this > one here: > https://github.com/Subsurface-divelog/subsurface/blob/master/core/units.h#L2 > 66 > > Using bool there failed with a compiler error. Why was/am I not able to > use bool there but in prefs.h one can use bool? > I guess I'm missing s.th. very obvious? > BTW: I also read the comment in prefs.h about bool at this time and was > even more confused then ;-)
Hard to say without knowing the error. I believe in C you have to #include <stdbool.h> to get bool, true and false defined. History. :) Berthold _______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
