You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can redefine return operator to an expression like:
#define return (0 ? &some_var : (some_type*)0),
Then you globally define some_var with some_type and locallly (in each function, via macros providing RAII) you re-declaring some_var with some_type2. Where some_type and some_type2 must be defined just like typedef struct { int dummy[1]; } some_type.
As a result, you will get compile error if you will try to perform return from block of code where RAII is assumed.
The text was updated successfully, but these errors were encountered:
Hey there,
thank you very much. This is a really cool idea!
I am currently in the process of moving to a new apartment, so I'll only have time to look at it in detail after the weekend.
I'll get back to you then.
Cheers!
~Marten/Qqwy
On March 18, 2022 2:14:52 PM UTC, Kirill Frolov ***@***.***> wrote:
See similar approach proposed for scoped locks: https://groups.google.com/g/comp.lang.c/c/KPeoMxlTqjI/m/ISz5IBifBgAJ
--
Reply to this email directly or view it on GitHub:
#3 (comment)
You are receiving this because you are subscribed to this thread.
Message ID: ***@***.***>
Hello...
I have a proposition.
You can redefine
return
operator to an expression like:Then you globally define
some_var
withsome_type
and locallly (in each function, via macros providing RAII) you re-declaringsome_var
withsome_type2
. Wheresome_type
andsome_type2
must be defined just liketypedef struct { int dummy[1]; } some_type
.As a result, you will get compile error if you will try to perform return from block of code where RAII is assumed.
The text was updated successfully, but these errors were encountered: