.TH "doc_decisions_bool_md" 3elektra "Sun May 29 2016" "Version 0.8.14" "Elektra" \" -*- nroff -*- .ad l .nh .SH NAME doc_decisions_bool_md \- Definition of bool .SS "Issue" .PP Inconsistent use of bool in various parts of Elektra\&. .PP .SS "Constraints" .PP .SS "Assumptions" .PP .IP "\(bu" 2 needs to be string .IP "\(bu" 2 convenience plugins can convert anything to 0 or 1 .IP "\(bu" 2 type checker plugins can reject everything not 0 or 1 .PP .PP .SS "Considered Alternatives" .PP .IP "\(bu" 2 strictly only allow 0 and 1 (would move validation across the code) .IP "\(bu" 2 only check presence or absence (no cascading override of already present key possible) .IP "\(bu" 2 use as in CMake (would move convenience across the code) .PP .PP .SS "Decision" .PP Use, depending on what your default should be: .PP .IP "\(bu" 2 0 is false, everything else is true (default is true) .IP "\(bu" 2 1 is true, everything else is false (default is false) .PP .PP Example: .PP .nf if ( strcmp(keyString(k), "0")) {/*true*/} else {/*false*/} if (!strcmp(keyString(k), "1")) {/*true*/} else {/*false*/} .fi .PP .PP In the documentation it should mention that a bool is used and which is the default\&. .PP The type checker plugin should allow .PP .IP "\(bu" 2 non-presence (default) .IP "\(bu" 2 the string '0' .IP "\(bu" 2 the string '1' .PP .PP The convenience plugin should transform (it might be combined with a plugin that transforms everything lower-case): .PP .IP "\(bu" 2 'false', 'off', 'no' to '0' .IP "\(bu" 2 'true', 'on', 'yes' to '1' .PP .PP .SS "Argument" .PP .IP "\(bu" 2 most easy to implement .IP "\(bu" 2 allows presence to be true .IP "\(bu" 2 plugins allow us to convert to any other behaviour .PP .PP .SS "Implications" .PP .IP "\(bu" 2 change code with different behavior .PP .PP .SS "Related decisions" .PP .SS "Notes" .PP See \fChere\fP