Quote:Original post by guyaton
kind of off topic, but say you have:
enum PlacesILike
{
Paris,
SanDiego,
Hawaii
};
and say you have a function
void Function( PlacesILike place );
is PlacesILike converted to an int value for this? or is it unsigned int?
It is of type PlacesILike. It will probably be represented internally with an int, but in C++ (not in C, where the type system is considerably weaker) it is a separate type.
Quote:
void AnotherFunction( short MorePlaces );
AnotherFunction( Paris );
in the function is MorePlaces converted to a short when passed into the funtion?
Yes; a function can only receive the data type that it claims to accept (and if no conversion is possible, it will not compile).
Quote:(inferign i should do: AnotherFunction( static_cast<short>( Paris ) ); )???
Implying, not inferring (consult your dictionary); and no, the conversion is implicit so you needn't do anything.
However, in C++ (again not in C, where the type system is considerably weaker) a cast IS required to go in the other direction. E.g. PlacesILike x; x = static_cast<PlacesILike>(2); or more simply x = PlacesILike(2);.
Reference