Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds new schema building macros for version 2.
The old macros are still available, but they are now implemented as wrappers around the new v2 macros.
The problem with the old macros was that they required a fixed number of parameters, and to handle optional fields in the schema, would have required multiple variants. Since more optional features are planned for v2, the multiple variants would have got out of hand. Alternatively the new macros could have contained arguments for setting every field, however this would have made them cumbersome and less attractive than using a struct initialiser directly.
The new macros are a compromise. The new macros take the
CYAML_[TYPE]
as a first parameter, and a struct initialiser for the type-specific anonymous union member may be provided as the last parameter.