Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Apr 2001 01:54:04 +0800
From:      Ying-Chieh Liao <ijliao@csie.nctu.edu.tw>
To:        freebsd-questions@FreeBSD.ORG
Subject:   cast int to enum in C++
Message-ID:  <20010413015404.A30645@terry.dragon2.net>

next in thread | raw e-mail | index | archive | help
In C, compiling following code is all ok
but in C++, there's some err msgs :

test.cpp:12: conversion from `int' to `enum test'

I've tried g++ -fenum-int-equiv test.cpp,
but it said that this flag is no longer supported :<

what can I do ? dont suggest me to change tmp(1) to tmp(TEST1) ...

<code>
typedef enum {
	TEST1=1, TEST2=2, TEST3=3
} test;

void tmp(test argv)
{
	return;
}

int main(void)
{
	tmp(1);
}
</code>
-- 
Allocate four digits for the year part of a date : a new millennium is coming.
					--- David Huber

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010413015404.A30645>