Hmm, when you copy and paste an enum into a `switch` so you don't get the names wrong but then you forget to add some keyword back... can you find it? ;)
Surprisingly, this compiles (but doesn't work as expected)... and I'm not a C expert enough to know why. But wow, that stumped me for a couple hours!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Ah! I had no idea C had labels and goto! Yikes.
I <3 JS closures.
Are you sure? yes | no
That's no problem because a void function doesn't need a return statement. If your function were int it would work, too, but the result is undefined. I'm not sure but I think that most compilers I worked with issued a warning when I forgot to return a value.
Are you sure? yes | no
Perhaps I misunderstand, but it's not the void function I was wondering about the lack of case keywords. Going back I do see warnings, but still surprised it compiled without error. Thanks for the response!
Are you sure? yes | no
Ah, now I see it :-) Labels, a relic of the Assembly age, sometimes useful for a clean escape, but not a thing one would expect in a switch statement. Nothing compared to the wonders of a JavaScript closure.
Are you sure? yes | no