| ftp.delorie.com/archives/browse.cgi | search |
| From: | Weiqi Gao <weiqigao AT a DOT crl DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: enum - Why does true == false? |
| Date: | Thu, 16 Sep 1999 23:31:37 -0500 |
| Organization: | CRL Network Services |
| Lines: | 28 |
| Message-ID: | <37E1C429.FA787217@a.crl.com> |
| References: | <HbrhNzeq9qsy9UvyzT4fDeX4Lrnh AT 4ax DOT com> |
| NNTP-Posting-Host: | a116002.stl1.as.crl.com |
| Mime-Version: | 1.0 |
| X-Mailer: | Mozilla 4.51 [en] (X11; I; Linux 2.2.5-15 i586) |
| X-Accept-Language: | en |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Carl Hover wrote:
>
> Why does this program print "true == false" when compiled with djgpp
> v2.01, and "true != false" when compiled with Borland C++ 3.1? Are
> enum constants ill-defined during preprocessing?
See K&R p.232, l.-11.
> #include <stdio.h>
>
> int main(void)
> {
> enum {false, true};
>
> #if true == false
> printf("true == false\n");
> #endif
>
> #if true != false
> printf("true != false\n");
> #endif
>
> return 0;
> }
--
Weiqi Gao
weiqigao AT a DOT crl DOT com
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |