enum true, or 1

Brian Tiffin bwtiffin at gmail.com
Thu Jul 22 03:44:13 UTC 2021


What is the preferred syntax for simple on/off states?  Did I 
read that D was moving to strictly 1 and 0 literals instead of 
true/false on/off yes/no?

If so, is there an idiom for yes/no/maybe  -1,0,1  
less/equal/greater?

Excuse the noise.  For some backfill; getting used to DDoc.  
Frontmatter can be attached to the module declaration.  Great for 
setting up a page.  Wanted to do something similar for 
backmatter, in particular the without warranty disclaimer 
(instead of it taking up space on the first screen of a listing). 
  That means attaching backmatter doc comments to a declaration, 
something akin to `enum INDEMNITY = true;`.  Or is it `= 1`?

Opinions welcome, as this will end up being nothing more than a 
personal preference, but it would be nice to avoid dragging 
fingernails over anyone's mental chalkboard.

Have good, make well.


More information about the Digitalmars-d-learn mailing list