Message290045
Passing var_decl was based on not knowing the answer to two questions:
* do we ever declare non-statics this way? (OTOH, if we do, this could be an opportunity to hide them behind read-only accessor functions)
* do we ever declare more specific types than PyObject * this way? (OTOH, if that's the uncommon case, requiring a cast to the more specific type probably wouldn't hurt)
As far as stack usage goes, all _Py_OnceVar instances should be in the data segment when using the linked list approach, so they shouldn't impact stack usage, and doing so retains the benefit of avoiding dynamic memory allocation just to track the static variable declarations. Since the macro is dereferencing the address of a static variable in the initialiser of another static variable, that shouldn't require any runtime stack space either. OTOH, I haven't actually ever tried compiling a macro like that, so it's entirely possible compilers won't like it. |
|
Date |
User |
Action |
Args |
2017-03-23 12:48:00 | ncoghlan | set | recipients:
+ ncoghlan, vstinner, eric.snow, serhiy.storchaka |
2017-03-23 12:48:00 | ncoghlan | set | messageid: <1490273280.72.0.566968293469.issue29881@psf.upfronthosting.co.za> |
2017-03-23 12:48:00 | ncoghlan | link | issue29881 messages |
2017-03-23 12:48:00 | ncoghlan | create | |
|