Re: [OT] Re: Teaching new tricks to an old dog (C++ -->Ada)

From: Ioannis Vranos (ivr_at_remove.this.grad.com)
Date: 03/13/05


Date: Sun, 13 Mar 2005 09:48:32 +0200

Greg Comeau wrote:

>>Now that I am thinking of it, isn't it a value range?
>>
>>
>>int main()
>>{
>> enum four_val {a,b,c,d};
>>
>> four_val x;
>>
>> x = 4;
>>}
>>
>>
>>C:\c>g++ temp.cpp -o temp.exe
>>temp.cpp: In function `int main()':
>>temp.cpp:7: error: invalid conversion from `int' to `main()::four_val'
>
>
> In C++ but not in C it's an error, but it can also be "invalidly"
> cast to the enum.

Yes, the subject in this thread is C++ and Ada. :-)

Also casting this means that you know what you are doing, and thus not
excused for mistakes. :-)

Thus you can't do that by accident.

-- 
Ioannis Vranos
http://www23.brinkster.com/noicys


Relevant Pages