Of course, this trick violates every coding standard in the book. Try doing this in your company's code and you will probably be subject to a stern telling off if not disciplinary action! You have embedded unmatched braces in macros, used case within sub-blocks, and as for the crReturn macro with its terrifyingly disruptive contents . . . It's a wonder you haven't been fired on the spot for such irresponsible coding practice. You should be ashamed of yourself.
Rule number one for professional developers: If code standards prevents you to create functional code, break those rules
A pity. Still, at least C++ users can manage this by having their coroutine be a class member, and keeping all its local variables in the class so that the scoping is implicit.)
Don't let anyone tell you that C can't do C++. Long before C++ existed C people were already using things that mimics C++.
C++ basically translates it to C code under the hood.
C++: MyObject.Foo(int a, int b)
Becomes this. Look at the assembly output so see that.
3 comments
2 u/roznak 09 Jan 2016 01:09
Rule number one for professional developers: If code standards prevents you to create functional code, break those rules
0 u/dchem [OP] 09 Jan 2016 01:20
Yep. Right after this he goes on to say that.
2 u/roznak 09 Jan 2016 01:17
Don't let anyone tell you that C can't do C++. Long before C++ existed C people were already using things that mimics C++. C++ basically translates it to C code under the hood.
Becomes this. Look at the assembly output so see that.