delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/19/03:04:21

From: "Tom Leete" <tleete AT access DOT mountain DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Bug? Or am I misusing something?
Date: Sun, 19 Jul 1998 02:55:56 -0400
Lines: 62
NNTP-Posting-Host: 198.77.57.131
Message-ID: <35b19846.0@news.mountain.net>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

    Hi, if I'm being boneheaded about something please hurry to tell me.
Aren't enums supposed to be distinct types, with their element names
overloaded?

// file- tenum.cpp - combines tenum.cpp with tenum.h
enum definiteAnswer{ no, yes};
enum anyAnswer{ no, yes, maybe};
int main(int,char**)
{
    definiteAnswer A;
    anyAnswer B;
    return 0;
}


********* [compiling]
bash$ gcc -Wall -v -o tenum.exe tenum.cpp
Reading specs from e:/djgpp/lib/gcc-lib/djgpp\2.81\specs
gcc version 2.8.1

e:/djgpp/lib/gcc-lib/djgpp\2.81\cpp.exe -lang-c++ -v -undef -D__GNUC__=2 -D_
_GN
UG__=2 -D__cplusplus -D__GNUC_MINOR__=8 -Dunix -Di386 -DGO32 -DMSDOS -DDJGPP
=2 -
DDJGPP_MINOR=1 -D__unix__ -D__i386__ -D__GO32__ -D__MSDOS__ -D__DJGPP__=2 -D
__DJ
GPP_MINOR__=1 -D__unix -D__i386 -D__GO32 -D__MSDOS -D__DJGPP=2 -D__DJGPP_MIN
OR=1
 -D__EXCEPTIONS -Wall tenum.cpp D:\temp\ccai52va
GNU CPP version 2.8.1 (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 e:/djgpp/contrib/grx23/include
 e:/djgpp/lang/cxx
 e:/djgpp/lib/gcc-lib/djgpp/2.81/include
 e:/djgpp/include
End of search list.
 e:/djgpp/lib/gcc-lib/djgpp\2.81\cc1plus.exe
D:\temp\ccai52va -quiet -dumpbase t
enum.cc -Wall -version -o D:\temp\ccbi52va
GNU C++ version 2.8.1 (djgpp) compiled by GNU C version 2.8.1.
In file included from tenum.cpp:4:
../include/tenum.h:12: conflicting types for `0'
../include/tenum.h:6: previous declaration as `enum definiteAnswer const no'
../include/tenum.h:13: conflicting types for `1'
../include/tenum.h:7: previous declaration as `enum definiteAnswer const
yes'
tenum.cpp: In function `int main(int, char **)':
tenum.cpp:9: warning: unused variable `enum anyAnswer B'
tenum.cpp:8: warning: unused variable `enum definiteAnswer A'
bash$
*********

Why does gcc think I'm trying to redeclare global `0' and `1'?
I think that this is pretty wrong, but I dont see how it could have been
missed.

Thanks,
--TML--



- Raw text -


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