Paul Eggert schrieb am Fr., 20. Nov. 2015 um 21:48 Uhr: > Philipp Stephani wrote: > > This member will typically be used as follows: > > > > if (env->size >= sizeof *env) { > > // good, object is at least as big as expected > > } else { > > // Emacs is too old > > } > > > I'm leery of recommending this sort of checking. In practice incompatible > structure layout changes so often involve something more than merely > extending a > structure, that a size check is not worth the trouble; No such incompatible changes can be allowed to the emacs_env and emacs_runtime structures. Only additions at the end of the structures are allowed. This is independent of how the version checking is made. > you really want a version > check. I might be persuaded that it's a good idea See Daniel's initial design ( https://lists.gnu.org/archive/html/emacs-devel/2015-02/msg00960.html) for rationale. > if I saw some code doing it > effectively, but currently there is no such code in the Emacs sources Not inside Emacs, but e.g. the Windows API uses this approach extensively for version checking, and has been forward- and backward-compatible for decades with it. > (the > module test function doesn't check sizes -- why not?). > Just an omission, we'll fix that. All modules need to do version checks so they don't run into UB if they use a more recent emacs-module.h than the Emacs in which they are loaded.