From: sl AT psycode DOT com (sl) To: "Eli Zaretskii" Cc: "DJGPP mailing list" Date: Mon, 15 Jun 98 03:40:11 Reply-To: "Gili" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: Re: enum problem Message-ID: <19980615072556700.AAA231@portC17.Generation.NET> Precedence: bulk On Mon, 15 Jun 1998 09:33:21 +0300 (IDT), Eli Zaretskii wrote: >Please post code that you actually used. The above snippet doesn't >compile ("parse error"), and while I can fix it, I'm unsure what did >your original code actually say, including the main function which you >didn't post at all. The code I actually used is too big to include in here.. But I'll make a compilable example: " #include enum lineType { sLine=0x00, dLine=0x01, overwrite=0x02, }; void saychoice(lineType choice) { if (choice|dLine==dLine) printf("double line chosen"); if (choice|overwrite==overwrite) printf("overwrite mode chosen"); } int main() { saychoice(sLine|overwrite); } " >This is certainly incorrect in general. Your enumeration defines only >two possible values: 0 and 2. Should it define 1 and 2, ORing them >would produce 3 which is invalid for this enumeration. True.. >Also, I strongly suspect that the type of an expression "a|b" is an >int, regardless of its value. (Could any ANSI guru please confirm >this?) I don't think so.. but I could be wrong ;) Gili