Skip to content

Ensure C++ compatibility in examples#552

Open
rats159 wants to merge 1 commit into
nicbarker:mainfrom
rats159:cpp-compatible-examples
Open

Ensure C++ compatibility in examples#552
rats159 wants to merge 1 commit into
nicbarker:mainfrom
rats159:cpp-compatible-examples

Conversation

@rats159
Copy link
Copy Markdown
Contributor

@rats159 rats159 commented Nov 24, 2025

This PR makes sure all the examples and examples renderers are as C++ compatible as possible, without changing any semantics. It mostly involves reordering initializers because the C++ standard requires that inside a designated initializer, all fields are initialized in the exact order they're declared, but also adds a few casts, and removes chained initializers like .layout.sizing.width.minMax = ..., because those are nonstandard in C++. It also removes a few non-braced initializers like .sizing = CLAY_SIZING_GROW(), and adds a few float literals where the language warns about implicit conversions.

There may still be a few cases of invalid C++ code, either because the example uses a C feature that C++ doesn't have (like compound literals (int[]) {1,2,3}), or because the errors/warnings were hidden by type errors from libraries I didn't have installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant