Stefan Dösinger [email protected] wrote:
+#define __TRY __try { do +#define __EXCEPT(func) while(0); } __except((func)(GetExceptionInformation())) { do +#define __FINALLY(func) while(0); } __finally { (func)(!AbnormalTermination()); } +#define __ENDTRY while(0); } +#define __EXCEPT_PAGE_FAULT while(0); } __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) { do +#define __EXCEPT_ALL while(0); } __except(EXCEPTION_EXECUTE_HANDLER) { do
Perhaps add another '{' after 'do' and and '}' before 'while(0)' ?
Am 2017-02-12 um 14:36 schrieb Dmitry Timoshkov:
Stefan Dösinger [email protected] wrote:
+#define __TRY __try { do +#define __EXCEPT(func) while(0); } __except((func)(GetExceptionInformation())) { do +#define __FINALLY(func) while(0); } __finally { (func)(!AbnormalTermination()); } +#define __ENDTRY while(0); } +#define __EXCEPT_PAGE_FAULT while(0); } __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) { do +#define __EXCEPT_ALL while(0); } __except(EXCEPTION_EXECUTE_HANDLER) { do
Perhaps add another '{' after 'do' and and '}' before 'while(0)' ?
The code that uses these macros has to put a '{' after __TRY/__EXCEPT and '}' before __EXCEPT, __ENDTRY and __FINALLY, so I don't think it is needed. If you think it'll make the macros more readable I can add them though.
Stefan
Stefan Dösinger [email protected] wrote:
+#define __TRY __try { do +#define __EXCEPT(func) while(0); } __except((func)(GetExceptionInformation())) { do +#define __FINALLY(func) while(0); } __finally { (func)(!AbnormalTermination()); } +#define __ENDTRY while(0); } +#define __EXCEPT_PAGE_FAULT while(0); } __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) { do +#define __EXCEPT_ALL while(0); } __except(EXCEPTION_EXECUTE_HANDLER) { do
Perhaps add another '{' after 'do' and and '}' before 'while(0)' ?
The code that uses these macros has to put a '{' after __TRY/__EXCEPT and '}' before __EXCEPT, __ENDTRY and __FINALLY, so I don't think it is needed. If you think it'll make the macros more readable I can add them though.
You are right, existing macros also don't have additional braces, so your new macros stay in line with current ones.