summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/new_list.c
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2023-06-29 09:32:39 +0200
committerTyge Lovset <[email protected]>2023-06-29 10:48:03 +0200
commit764d6b5a831c4ff58fb717a1360fe80f691a424d (patch)
tree55b0353d1952f749dc34d4286b25970de4039545 /misc/examples/new_list.c
parent5096c3c951f6b99e9d6ee04a21531e226153cca9 (diff)
downloadSTC-modified-764d6b5a831c4ff58fb717a1360fe80f691a424d.tar.gz
STC-modified-764d6b5a831c4ff58fb717a1360fe80f691a424d.zip
Usage change: comparison is no longer enabled when specifying i_val for cvec, cdeq and clist (like cstack and cqueue). Comparison functions are still required when specifying i_valclass. For fundamental/native types like integers, floats etc., define i_native_cmp along with i_val instead of i_less/i_cmp/i_eq.
Diffstat (limited to 'misc/examples/new_list.c')
-rw-r--r--misc/examples/new_list.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/misc/examples/new_list.c b/misc/examples/new_list.c
index 382943bb..b5ff847e 100644
--- a/misc/examples/new_list.c
+++ b/misc/examples/new_list.c
@@ -27,12 +27,13 @@ int point_cmp(const Point* a, const Point* b) {
#include <stc/clist.h>
#define i_val float
+#define i_native_cmp // use < and == operators for comparison
#include <stc/clist.h>
void MyStruct_drop(MyStruct* s);
#define i_type MyList
-#define i_valclass MyStruct // i_valclass uses MyStruct_drop
-#define i_opt c_no_clone|c_no_cmp
+#define i_valclass MyStruct // MyStruct contains "class"-types, so define as "class"
+#define i_opt c_no_clone|c_no_cmp // exclude cloning and comparison support
#include <stc/clist.h>
void MyStruct_drop(MyStruct* s) {