Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FMU3 (and similar) constructors should probably initialize all fields #44

Open
topolarity opened this issue Oct 31, 2024 · 1 comment
Open

Comments

@topolarity
Copy link

The constructor here:

function FMU3(logLevel::FMULogLevel = FMULogLevelWarn)
inst = new()
inst.instances = []
inst.modelName = ""
inst.logLevel = logLevel

leaves a lot of fields undefined, including many pointer fields that are probably best to explicitly set to C_NULL

Julia does not zero-initialize plain data fields, so these contain garbage data. For example, if someone fails to initialize one of these pointers, it's probably best to guarantee you'll get a NULL pointer de-reference, rather than accessing random memory.

@ThummeTo
Copy link
Owner

ThummeTo commented Nov 4, 2024

True and will be fixed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants