Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions shell/platform/embedder/embedder.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
// - Function signatures (names, argument counts, argument order, and argument
// type) cannot change.
// - The core behavior of existing functions cannot change.
// - Instead of array of structures, prefer array of pointers to structures.
// This ensures that array indexing does not break if members are added
// to the structure.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM.

As you noted separately, we could limit this to embedder-facing arrays of structs passed back in e.g. callbacks since for incoming structs, since for structs going the other way (being passed into the engine) we always use safe dereference macros, but we can't guarantee that third-party embedders do the same.

All that said, I think there's a lot of value in keeping the advice here as succinct as possible and there are no downsides to doing this in both directions aside from making things a very small amount more onerous for embedders. @chinmaygarde probably has thoughts on this.

//
// These changes are allowed:
// - Adding new struct members at the end of a structure.
Expand Down