Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Re-entrant implicit operator
Message
From
08/08/2016 03:42:22
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Re-entrant implicit operator
Miscellaneous
Thread ID:
01639212
Message ID:
01639212
Views:
56
Interesting bit of bad code which the compiler does not catch and which causes stack overflow because it is re-entrant:
static void Main(string[] args)
        {
            Test test = "Hello World";
        }

    public class Test
    {
        public static implicit operator Test(string s)
        {
            return s; // obviously wrong but compiles and is re-entrant when run
        }
    }
Next
Reply
Map
View

Click here to load this message in the networking platform