🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3689

enums and conversion question

#3689
From: raviyer
Date: Sat, 16 Mar 1996 06:04
36 lines
1906 bytes
Hi,

I have the following piece of code,

void goo(int);
void goo(unsigned int);

enum Enum {E1,E2}

void foo ()
{
	Enum e = E1;
	goo(e); // Is this call ambiguos?
}

The DWP in 4.5 (integral promotion) point 2 says that 
"An rvalue of type wchar_t or an enumeration type can be converted to an
rvalue of the _first_ of the following types that can represent all the values
of the source type: int, unsigned int, long, unsigned long."

Does this mean that in the above example the call to goo(e) should be resolved
to goo(int)? or in other words is the promotion enum -> int better than 
enum -> unsigned int in this case?

thanks in advance
-- 
|#include <stddisclaimers.h> // My own views                                |
|Ravikant Iyer. aka - ravi - raviyer@nt.com                                 |
|Nortel. Santa Clara CA. Off: 408-565-7430                                  |
|                               ESN-655-7430.                               |
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Technical Details
Message-ID: <4icihu$e3d@nrchh52.rich.nt.com>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back

Show Full Headers
Complete Article Headers
From: raviyer@nt.com
Message-ID: <4icihu$e3d@nrchh52.rich.nt.com>
X-Original-Date: Fri, 15 Mar 1996 20:02:14 +0000
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 16 Mar 96 06:04:34 GMT
Approved: fjh@cs.mu.oz.au
Return-Path: <daemon@meeker.UCAR.EDU>
Subject: enums and conversion question
Newsgroups: comp.std.c++
Organization: Northern Telecom Inc., Mission Park
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMUpaEuEDnX0m9pzZAQGJjgF/Q8HmNIJVoN5m4K1WtGQhukaguiMJAhL5
 W7wV8W1cA8yoRy9BXi7Uc9OCbgAPmr7O
 =Lej1