[C--] bool and bits1
Ning Wang <[email protected]> Fri, 20 Mar 2009 18:56:17 -0700
| Newsgroups | gmane.comp.lang.c-- |
|---|---|
| Message-ID | <[email protected]> |
Hi, My front-end takes a very simple strategy. Instead of only simplifying complex expression wherever it's necessary, it translates all complex expressions to three address forms. This brings me to the bool and bits1 issue. In C--, the type of predicate and logic expressions is bool, and there is no bool type in C-- grammar. That said, it's not possible to allocate temporary variables of bool to simplify complicate predicate/logic expressions to three address forms. But C-- does allow you to allocate variables of bits1 and convert the C-- expressions of bool to bits1. If you want to compute the conjunction of two sub predicates whose results are now stored in two bits1 variables, then you have to convert it back to bool. The type conversions between bool and bits1 seem redundant. My questions are: 1. Why there is no bool type in the C-- grammar, but the semantics of C-- has bool type? allowing bool type would eliminate the above redundant type conversions. 2. I guess most of the use of bits1 is like the above case. Any exception? Why bool and bits1 are not equivalent types? Thanks, Ning _______________________________________________ Cminusminus mailing list [email protected] https://www.eecs.harvard.edu/mailman/listinfo/cminusminus