Merged
Conversation
Using const cea_real[] instead of const cea_array makes it easier to pass data to the inface without generating incompatible pointer type warnings. It also better reflects the design intent; not only will the pointer not be changed, but the data pointed to will not be changed. Updated example 9 to demonstrate that this works without warnings for both const and non-const data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Bind C examples generate multiple warnings of the form below. Switching cea.h from
const cea_arrayto constconst cea real[]avoids these warnings, and permits passing the expected types.cea\source\bind\c\samples\rp1311_example9.c(75,68): warning: passing 'const cea_real[1]' (aka 'const double[1]') to parameter of type 'cea_array' (aka 'double *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] 75 | cea_rocket_solver_solve_fac(solver, soln, weights, pc, pip, 3, subar, 0, supar, 3, 0, hc, TRUE, ac_at, FALSE, 0.0, FALSE);Changes
const cea_arraytoconst cea_real[]to suppress warnings. Also better matches the intent. The array data is treated as const, not just the pointer.cea_real[]can be passed without warnings.Testing
Compatibility / Numerical behavior