equal
deleted
inserted
replaced
309 @released |
309 @released |
310 |
310 |
311 Symbolic definition for a false value. |
311 Symbolic definition for a false value. |
312 */ |
312 */ |
313 #define FALSE 0 |
313 #define FALSE 0 |
|
314 |
|
315 |
|
316 |
|
317 |
314 #ifndef NULL |
318 #ifndef NULL |
315 |
|
316 |
|
317 |
|
318 |
|
319 /** |
319 /** |
320 @publishedAll |
320 @publishedAll |
321 @released |
321 @released |
322 |
322 |
323 Symbolic definition for a NULL value. |
323 Symbolic definition for a NULL value. |
752 |
752 |
753 /** |
753 /** |
754 @publishedAll |
754 @publishedAll |
755 @released |
755 @released |
756 |
756 |
757 Boolean type which takes the value either ETrue or EFalse. |
757 Integer type representing true or false. |
758 |
758 |
759 Although only a single bit would theoretically be necessary to represent a |
759 False is always represented by 0; any non-zero value is true. |
760 Boolean, a machine word is used instead, so that these quantities can be easily |
760 |
761 passed. Also, TBool must map onto int because of C++'s interpretation of |
761 Values of type TBool must never be compared against ETrue; so instead of |
762 operands in conditional expressions. |
762 |
|
763 @code |
|
764 TBool foo(void); |
|
765 |
|
766 if (foo() == ETrue) bar(); |
|
767 @endcode |
|
768 |
|
769 use |
|
770 |
|
771 @code |
|
772 TBool foo(void); |
|
773 |
|
774 if (foo()) bar(); |
|
775 @endcode |
|
776 |
|
777 And, instead of '!= ETrue' use '== EFalse' or the following (preferred): |
|
778 |
|
779 @code |
|
780 TBool this(void); |
|
781 |
|
782 if (!this()) that(); |
|
783 @endcode |
|
784 |
|
785 When returning a TBool, rather than |
|
786 |
|
787 @code |
|
788 TBool List::IsEmpty(void) |
|
789 { |
|
790 return iAnchor == NULL ? ETrue : EFalse; |
|
791 } |
|
792 @endcode |
|
793 |
|
794 use |
|
795 |
|
796 @code |
|
797 TBool List::IsEmpty(void) |
|
798 { |
|
799 return iAnchor == NULL; |
|
800 } |
|
801 @endcode |
|
802 |
|
803 and rather than |
|
804 |
|
805 @code |
|
806 TBool SerialPort::DataPresent(void) |
|
807 { |
|
808 // Fictitious example |
|
809 volatile TUint *statusReg = (TUint *)0x1000; |
|
810 |
|
811 if ((*statusReg & 0x00FF0000) != 0) |
|
812 return ETrue; |
|
813 else |
|
814 return EFalse; |
|
815 } |
|
816 @endcode |
|
817 |
|
818 use |
|
819 |
|
820 @code |
|
821 TBool SerialPort::DataPresent(void) |
|
822 { |
|
823 // Fictitious example |
|
824 volatile TUint *statusReg = (TUint *)0x1000; |
|
825 |
|
826 return *statusReg & 0x00FF0000; |
|
827 } |
|
828 @endcode |
|
829 |
|
830 @see EFalse |
|
831 @see ETrue |
763 */ |
832 */ |
764 typedef int TBool; |
833 typedef int TBool; |
765 |
834 |
766 |
835 |
767 |
836 |
1279 raises a panic. |
1348 raises a panic. |
1280 |
1349 |
1281 Note that the macro definition is, in effect, equivalent to: |
1350 Note that the macro definition is, in effect, equivalent to: |
1282 |
1351 |
1283 @code |
1352 @code |
1284 if !(c)p; |
1353 if (!c)p; |
1285 @endcode |
1354 @endcode |
1286 |
1355 |
1287 @param c a conditional expression which results in true or false. |
1356 @param c a conditional expression which results in true or false. |
1288 @param p a function which is called if the conditional expression c is false. |
1357 @param p a function which is called if the conditional expression c is false. |
1289 |
1358 |