5 ms·
I'm not sure that 'address' is desirable. int adress adress adress foo; vs int * * * foo; Double pointers are extremely common and triple pointers s
by generic_user 10y ago
I'm not sure that 'address' is desirable.
int adress adress adress foo;
vs
int * * * foo;
Double pointers are extremely common and triple pointers show up now and then.
Also '__attribute__ cleanup' as far as I know only works with automatic variables that live on the stack. Mucking about with code execution and automatic variables as the stack unwinds is not a style I would like to see in general purpose C coding. Its the one type of automatic memory management that you get for free and can't really screw up.
The rest of the macro loops and so forth seem fairly standard. Its good to experiment and explore what you can do with the compiler and the preprocessor.
- noobermin 10y agoint double_address foo; /* ? */ Or is it n steps away from ProducerObserverFactoryStragedy?
- mdadm 10y agoYou know there'll be that one person who complains about it not supporting something nested like 20 pointers deep...
- generic_user 10y agoActually, its not even an address its a pointer. To get the address of an object you use the unary 'address of' operator '&'. His macro was #define address * The * is a pointer. You can declare a variable of type pointer to T with as many indirections as you want. int * * * * * * foo is fine. But you also use it to deference your object. bob = * foo; You can't practically have a different name for each level of indirection to what ever the IS0 standard/Compiler limit is for * . Also you end up with nasty indirections like this. **(*((struct foo*)(*bob.x))).y Its nasty enough as it is without trying to name each pointer indirection.