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
Currently throughout the gr modules gr_ctx_t is not marked as const. The reason is that some contexts store data that is expected to mutate during computations, notably Calcium. There are also other contexts where it would make sense to implement various caching mechanisms in the future.
However, we could make the gr_ctx_t itself const and require that mutable caches be located in separate memory which is only pointed to by the gr_ctx_t (C allows this for const structures).
Now, some contexts do have mutable inline data, e.g. precisions. I think to be clean only the scope that owns a context object should be allowed to mutate such data. This means that if one wants to change the precision locally, one would need to do something like
Also, maybe the method table pointer in the gr_ctx_t should be declared as const * const. I'm not sure if this would allow the compiler to omit some repeated dereferences.
The text was updated successfully, but these errors were encountered:
Currently throughout the
gr
modulesgr_ctx_t
is not marked asconst
. The reason is that some contexts store data that is expected to mutate during computations, notably Calcium. There are also other contexts where it would make sense to implement various caching mechanisms in the future.However, we could make the
gr_ctx_t
itselfconst
and require that mutable caches be located in separate memory which is only pointed to by thegr_ctx_t
(C allows this forconst
structures).Now, some contexts do have mutable inline data, e.g. precisions. I think to be clean only the scope that owns a context object should be allowed to mutate such data. This means that if one wants to change the precision locally, one would need to do something like
That makes sense for thread safety, anyway.
Also, maybe the method table pointer in the
gr_ctx_t
should be declared asconst * const
. I'm not sure if this would allow the compiler to omit some repeated dereferences.The text was updated successfully, but these errors were encountered: