Commit Graph

7 Commits (ad4a204edf138c4123b2e6eb5134bb3ec8424090)

Author SHA1 Message Date
whitequark e969bc94ad Enable -Wall -Wextra -Wno-unused-parameter on GCC/Clang.
This is good practice and helps to catch bugs. Several changes
were made to accomodate the newly enabled warnings:
  * -Wunused-function:
    * in exposed/, static functions that were supposed to be inlined
      were explicitly marked as inline;
    * some actually unused functions were removed;
  * -Wsign-compare: explicit conversions were added, and in
    the future we should find a nicer way than aux* fields;
  * -Wmissing-field-initializers: added initializers;
  * -Wreorder: reordered properly;
  * -Wunused-but-set-variable: remove variable.

-Wunused-parameter was turned off as enabling it would result in
massive amount of churn in UI code. Despite that, we should enable
it at some point as it has a fairly high SNR otherwise.
2016-05-08 00:01:35 +00:00
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