Commit Graph

6 Commits (07f3ab95e49ddcf7dec2e22c41611b0312ef0b57)

Author SHA1 Message Date
whitequark 45f056c852 Replace all ZERO and memset with C++11 brace-initialization.
This will allow us to use non-POD classes inside these objects
in future and is otherwise functionally equivalent, as well
as more concise.

Note that there are some subtleties with handling of
brace-initialization. Specifically:

On aggregates (e.g. simple C-style structures) using an empty
brace-initializer zero-initializes the aggregate, i.e. it makes
all members zero.

On non-aggregates an empty brace-initializer calls the default
constructor. And if the constructor doesn't explicitly initialize
the members (which the auto-generated constructor doesn't) then
the members will be constructed but otherwise uninitialized.

So, what is an aggregate class? To quote the C++ standard
(C++03 8.5.1 §1):

An aggregate is an array or a class (clause 9) with no
user-declared constructors (12.1), no private or protected
non-static data members (clause 11), no base classes (clause 10),
and no virtual functions (10.3).

In SolveSpace, we only have to handle the case of base classes;
Constraint and Entity have those. Thus, they had to gain a default
constructor that does nothing but initializes the members to zero.
2016-01-13 06:45:16 +00:00
Roland Lutz 413ab5f578 Move library header to include/ directory 2015-03-02 21:46:11 +01:00
Daniel Richard G fd9dc19a34 Added the exposed/ library and demo program to the Autotools build
The libslvs library and CDemo program can now be built by Autotools. A few
code changes were needed for this: C++ comments in C code had to be
converted, constraint.cpp required some massaging, and fltkutil.cpp needed
a stub for InitHeaps().
2013-12-02 04:27:33 -05:00
Jonathan Westhues 0ee8ba1457 Changes in preparation for the release of SolveSpace under the GPL,
to add that license, and change all copyright notices to me, not
Useful Subset, LLC.

[git-p4: depot-paths = "//depot/solvespace/": change = 2211]
2013-07-28 14:08:34 -08:00
Jonathan Westhues 1abd87954c Oops, fix gross memory leak in SolveSpace library due to failure
to destroy temporary heap.

[git-p4: depot-paths = "//depot/solvespace/": change = 2210]
2013-03-15 08:43:35 -08:00
Jonathan Westhues fc3dc68f83 Check in the VB.NET example for the SolveSpace library, and update
the documentation accordingly. Also rename the C example for
consistency, and update copyright dates.

[git-p4: depot-paths = "//depot/solvespace/": change = 2190]
2011-03-13 00:04:09 -08:00