Skip to content

Commit

Permalink
Clarify that a null pointer is an error. (modelica#3503)
Browse files Browse the repository at this point in the history
* Clarify that a null pointer is an error.
Closes modelica#3500
Co-authored-by: Henrik Tidefelt <[email protected]>
  • Loading branch information
HansOlsson authored Jul 1, 2024
1 parent 6004be0 commit af0be8d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions chapters/functions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2661,6 +2661,7 @@ \subsection{External Objects}\label{external-objects}
The {\lstinline!constructor!} shall have exactly one output argument in which the constructed instance derived from {\lstinline!ExternalObject!} is returned.
The arguments to the constructor must not -- directly nor indirectly -- depend on the external object being constructed.
The constructor shall initialize the object, and must not require any other calls to be made for the initialization to be complete (e.g., from an initial algorithm or initial equation).
To indicate failure, the \lstinline!constructor! may return a null pointer, to be treated in the same way as a failed \lstinline!assert! in Modelica.

The constructor shall not assume that pointers sent to the external object will remain valid for the life-time of the external object.
An exception is that if the pointer to another external object is given as argument to the constructor, that pointer will remain valid as long as the other external object lives.
Expand Down

0 comments on commit af0be8d

Please sign in to comment.