From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Stephani
Philipp Stephani wrote:
> This member will typically be used as follows:
>
> if (env->size >=3D sizeof *env) {
>=C2=A0 =C2=A0 // good, object is at least as big as expected
> } else {
>=C2=A0 =C2=A0 // Emacs is too old
> }
I'm leery of recommending this sort of checking.=C2=A0 In practice inco= mpatible
structure layout changes so often involve something more than merely extend= ing a
structure, that a size check is not worth the trouble;
you really want a version
check.=C2=A0 I might be persuaded that it's a good idea
if I saw some code doing i= t
effectively, but currently there is no such code in the Emacs sourcesNot inside Emacs, but e.g. the Windows API uses = this approach extensively for version checking, and has been forward- and b= ackward-compatible for decades with it.=C2=A0(the=
module test function doesn't check sizes -- why not?).=C2=A0Just 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.= --089e0102def4da90850525008369--