Re: Possible switch/case bug
- Posted by wynco Jun 14, 2012
- 1158 views
The following code 'works' when interpreted, but generates a duplicate case value error if compiled with gcc.
It should generates a duplicate case value error when interpreted, or am I missing something.
I also noticed that the last 'case' will trigger, regardless which 'case' comes first. Should it not trigger the first case?
Yes, this is a bug, recently fixed. See ticket:744. In 4.1, this will be an interpreter error, too. Basically, your code is telling euphoria to do two contradictory things. We were checking for duplicate symbols, but not duplicate values.
Matt
Excellent. I found it when I had a logic error in my program that was passing the interpreter fine but when compiled it was showing up. It would have caused the interpreted version of my program to display an incorrect error message to the user at some point. Must be time to upgrade from 4.0.3 to 4.1