We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
none
Objects that need initialization are not checked before use weither they got initialized or not.
Add a macro lib providing:
#define CANARY 0xc0ffee #define NEEDS_INIT uint _initialized; #define SET_INIT(p) { (p)->_initialized = CANARY; } //needs further checks #define RESET_INIT(p) { (p)_initialized = 0x0; } //needs further checks #define CHECK_INIT(p) { if ( (p)->initialized != CANARY ) { /*throw error*/ } } struct object { NEEDS_INIT; int foo; }; void using_object( struct object *o) { CHECK_INIT(o); ... } void object_init( struct object *o ) { ... SET_INIT(o); } void object_reset( struct object *o) { RESET_INIT(o); ... }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Related Issues & PRs
none
Description
Objects that need initialization are not checked before use weither they got initialized or not.
Solution
Add a macro lib providing:
Alternative solutions
Context
The text was updated successfully, but these errors were encountered: