delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/17/01:54:15

From: Carl Hover <buzz AT off DOT spambots>
Newsgroups: comp.os.msdos.djgpp
Subject: enum - Why does true == false?
Message-ID: <HbrhNzeq9qsy9UvyzT4fDeX4Lrnh@4ax.com>
X-Newsreader: Forte Agent 1.6/32.525
X-No-Archive: yes
MIME-Version: 1.0
Lines: 22
NNTP-Posting-Date: Thu, 16 Sep 1999 22:49:32 CDT
Organization: Giganews.Com - Premium News Outsourcing
X-Trace: sv1-2ITIzBF4nJrzAMt5vDtlkz9A31ujuyVI621I1y2r4KgnNx1weca/eIDBAvADBuQMNnsQMVDKemeyL1T!VyOH5A==
X-Complaints-To: abuse AT GigaNews DOT Com
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
Date: Thu, 16 Sep 1999 20:49:32 -0700
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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?


#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;
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019