summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortylov <[email protected]>2023-07-15 23:20:16 +0200
committertylov <[email protected]>2023-07-15 23:20:16 +0200
commite9121702a5d69624ef1e782e85a8f032e4f4e875 (patch)
tree00e7770c9b775d98b518d9e3929b6ec4f71ad754
parent23aebb77554bc43c929704e9f1c46dc4520024df (diff)
downloadSTC-modified-e9121702a5d69624ef1e782e85a8f032e4f4e875.tar.gz
STC-modified-e9121702a5d69624ef1e782e85a8f032e4f4e875.zip
Improved warning, and other enhancements in ccommon.h
-rw-r--r--README.md2
-rw-r--r--docs/carc_api.md2
-rw-r--r--docs/cbox_api.md2
-rw-r--r--docs/ccommon_api.md10
-rw-r--r--docs/cdeq_api.md2
-rw-r--r--docs/clist_api.md6
-rw-r--r--docs/cmap_api.md12
-rw-r--r--docs/cpque_api.md2
-rw-r--r--docs/cqueue_api.md2
-rw-r--r--docs/crandom_api.md2
-rw-r--r--docs/cregex_api.md2
-rw-r--r--docs/cset_api.md2
-rw-r--r--docs/csmap_api.md8
-rw-r--r--docs/cspan_api.md6
-rw-r--r--docs/csset_api.md2
-rw-r--r--docs/cstack_api.md2
-rw-r--r--docs/cstr_api.md2
-rw-r--r--docs/csview_api.md6
-rw-r--r--docs/cvec_api.md4
-rw-r--r--include/c11/fmt.h2
-rw-r--r--include/stc/algo/crange.h2
-rw-r--r--include/stc/algo/filter.h2
-rw-r--r--include/stc/algo/sort.h4
-rw-r--r--include/stc/carc.h4
-rw-r--r--include/stc/cbits.h2
-rw-r--r--include/stc/cbox.h4
-rw-r--r--include/stc/ccommon.h6
-rw-r--r--include/stc/clist.h2
-rw-r--r--include/stc/crand.h2
-rw-r--r--include/stc/cvec.h2
-rw-r--r--misc/benchmarks/plotbench/cpque_benchmark.cpp2
-rw-r--r--misc/benchmarks/various/cspan_bench.c2
-rw-r--r--misc/benchmarks/various/rust_cmap.c2
-rw-r--r--misc/benchmarks/various/sso_bench.cpp2
-rw-r--r--misc/benchmarks/various/string_bench_STC.cpp2
-rw-r--r--misc/benchmarks/various/string_bench_STD.cpp2
-rw-r--r--misc/examples/arc_containers.c2
-rw-r--r--misc/examples/arc_demo.c2
-rw-r--r--misc/examples/arcvec_erase.c2
-rw-r--r--misc/examples/birthday.c2
-rw-r--r--misc/examples/bits2.c2
-rw-r--r--misc/examples/books.c2
-rw-r--r--misc/examples/box.c2
-rw-r--r--misc/examples/cointerleave.c2
-rw-r--r--misc/examples/complex.c2
-rw-r--r--misc/examples/convert.c2
-rw-r--r--misc/examples/csmap_erase.c2
-rw-r--r--misc/examples/csmap_find.c2
-rw-r--r--misc/examples/csmap_insert.c2
-rw-r--r--misc/examples/csset_erase.c2
-rw-r--r--misc/examples/cstr_match.c2
-rw-r--r--misc/examples/demos.c18
-rw-r--r--misc/examples/dining_philosophers.c2
-rw-r--r--misc/examples/forloops.c2
-rw-r--r--misc/examples/functor.c2
-rw-r--r--misc/examples/gauss2.c2
-rw-r--r--misc/examples/generator.c2
-rw-r--r--misc/examples/intrusive.c2
-rw-r--r--misc/examples/list.c2
-rw-r--r--misc/examples/list_erase.c2
-rw-r--r--misc/examples/list_splice.c2
-rw-r--r--misc/examples/lower_bound.c2
-rw-r--r--misc/examples/mmap.c2
-rw-r--r--misc/examples/multidim.c2
-rw-r--r--misc/examples/multimap.c2
-rw-r--r--misc/examples/music_arc.c4
-rw-r--r--misc/examples/new_list.c2
-rw-r--r--misc/examples/new_map.c2
-rw-r--r--misc/examples/new_pque.c2
-rw-r--r--misc/examples/new_queue.c2
-rw-r--r--misc/examples/new_smap.c2
-rw-r--r--misc/examples/new_vec.c2
-rw-r--r--misc/examples/person_arc.c2
-rw-r--r--misc/examples/printspan.c2
-rw-r--r--misc/examples/priority.c2
-rw-r--r--misc/examples/queue.c2
-rw-r--r--misc/examples/random.c2
-rw-r--r--misc/examples/rawptr_elements.c2
-rw-r--r--misc/examples/read.c2
-rw-r--r--misc/examples/regex2.c2
-rw-r--r--misc/examples/regex_match.c2
-rw-r--r--misc/examples/regex_replace.c2
-rw-r--r--misc/examples/replace.c2
-rw-r--r--misc/examples/scheduler.c2
-rw-r--r--misc/examples/sidebyside.cpp2
-rw-r--r--misc/examples/sorted_map.c2
-rw-r--r--misc/examples/splitstr.c2
-rw-r--r--misc/examples/sso_map.c2
-rw-r--r--misc/examples/sso_substr.c2
-rw-r--r--misc/examples/stack.c2
-rw-r--r--misc/examples/sview_split.c2
-rw-r--r--misc/examples/triples.c2
-rw-r--r--misc/examples/unordered_set.c2
-rw-r--r--misc/examples/utf8replace_c.c2
-rw-r--r--misc/examples/vikings.c2
95 files changed, 128 insertions, 128 deletions
diff --git a/README.md b/README.md
index 1601204d..b7e06790 100644
--- a/README.md
+++ b/README.md
@@ -181,7 +181,7 @@ Switching to a different container type, e.g. a sorted set (csset):
#include <stc/csset.h> // Use a sorted set instead
#include <stdio.h>
-int main()
+int main(void)
{
Floats nums = {0};
Floats_push(&nums, 30.f);
diff --git a/docs/carc_api.md b/docs/carc_api.md
index 254f868a..8b7b67a1 100644
--- a/docs/carc_api.md
+++ b/docs/carc_api.md
@@ -97,7 +97,7 @@ bool carc_X_value_eq(const i_key* x, const i_key* y);
#define i_keyboxed Arc // Note: use i_keyboxed for carc or cbox value types
#include <stc/cstack.h>
-int main()
+int main(void)
{
Stack s1 = {0}, s2 = {0};
Map *map;
diff --git a/docs/cbox_api.md b/docs/cbox_api.md
index 83d59521..b6c76d2f 100644
--- a/docs/cbox_api.md
+++ b/docs/cbox_api.md
@@ -90,7 +90,7 @@ void int_drop(int* x) {
#define i_keyboxed IBox // NB: use i_keyboxed instead of i_key
#include <stc/cvec.h> // IVec : std::vector<std::unique_ptr<int>>
-int main()
+int main(void)
{
IVec vec = c_init(Vec, {2021, 2012, 2022, 2015});
ISet set = {0};
diff --git a/docs/ccommon_api.md b/docs/ccommon_api.md
index 6bce56af..e053f743 100644
--- a/docs/ccommon_api.md
+++ b/docs/ccommon_api.md
@@ -137,7 +137,7 @@ bool isPrime(long long i) {
return true;
}
-int main() {
+int main(void) {
// Get 10 prime numbers starting from 1000. Skip the first 15 primes,
// then select every 25th prime (including the initial).
crange R = crange_make(1001, INT64_MAX, 2); // 1001, 1003, ...
@@ -214,7 +214,7 @@ There is a [benchmark/test file here](../misc/benchmarks/various/csort_bench.c).
#include <stc/algo/sort.h>
#include <stdio.h>
-int main() {
+int main(void) {
int nums[] = {5, 3, 5, 9, 7, 4, 7, 2, 4, 9, 3, 1, 2, 6, 4};
intarray_sort_n(nums, c_arraylen(nums));
c_forrange (i, c_arraylen(arr)) printf(" %d", arr[i]);
@@ -230,7 +230,7 @@ possible and very fast. Note that `i_more` must be defined to retain specified t
#include <stc/algo/sort.h>
#include <stdio.h>
-int main() {
+int main(void) {
MyDeq deq = c_init(MyDeq, {5, 3, 5, 9, 7, 4, 7, 2, 4, 9, 3, 1, 2, 6, 4});
MyDeq_sort_n(&deq, MyDeq_size(&deq));
c_foreach (i, MyDeq, deq) printf(" %d", *i.ref);
@@ -348,7 +348,7 @@ int gcd(int a, int b) { // greatest common denominator
return a;
}
-int main()
+int main(void)
{
struct triples t = {.n=INT32_MAX};
int n = 0;
@@ -500,7 +500,7 @@ cvec_str readFile(const char* name)
return vec;
}
-int main()
+int main(void)
{
c_with (cvec_str vec = readFile(__FILE__), cvec_str_drop(&vec))
c_foreach (i, cvec_str, vec)
diff --git a/docs/cdeq_api.md b/docs/cdeq_api.md
index 292b0933..c6de6cd6 100644
--- a/docs/cdeq_api.md
+++ b/docs/cdeq_api.md
@@ -101,7 +101,7 @@ void cdeq_X_value_drop(cdeq_X_value* pval);
#include <stdio.h>
-int main() {
+int main(void) {
cdeq_i q = cdeq_i_init();
cdeq_i_push_front(&q, 10);
c_foreach (i, cdeq_i, q)
diff --git a/docs/clist_api.md b/docs/clist_api.md
index 023cca41..3d785789 100644
--- a/docs/clist_api.md
+++ b/docs/clist_api.md
@@ -122,7 +122,7 @@ Interleave *push_front()* / *push_back()* then *sort()*:
#include <stdio.h>
-int main() {
+int main(void) {
DList list = c_init(DList, {10., 20., 30., 40., 50., 60., 70., 80., 90.});
c_forrange (i, 1, 10) {
@@ -159,7 +159,7 @@ Use of *erase_at()* and *erase_range()*:
#include <stdio.h>
-int main ()
+int main(void)
{
clist_i L = c_init(clist_i, {10, 20, 30, 40, 50});
// 10 20 30 40 50
@@ -194,7 +194,7 @@ Splice `[30, 40]` from *L2* into *L1* before `3`:
#include <stdio.h>
-int main() {
+int main(void) {
clist_i L1 = c_init(clist_i, {1, 2, 3, 4, 5});
clist_i L2 = c_init(clist_i, {10, 20, 30, 40, 50});
diff --git a/docs/cmap_api.md b/docs/cmap_api.md
index 8ef322e6..eca350b4 100644
--- a/docs/cmap_api.md
+++ b/docs/cmap_api.md
@@ -121,7 +121,7 @@ bool c_memcmp_eq(const i_keyraw* a, const i_keyraw* b); // !
#define i_val_str
#include <stc/cmap.h>
-int main()
+int main(void)
{
// Create an unordered_map of three strings (that map to strings)
cmap_str umap = c_init(cmap_str, {
@@ -165,7 +165,7 @@ This example uses a cmap with cstr as mapped value.
#define i_val_str
#include <stc/cmap.h>
-int main()
+int main(void)
{
uint32_t col = 0xcc7744ff;
@@ -208,7 +208,7 @@ typedef struct { int x, y, z; } Vec3i;
#define i_tag vi
#include <stc/cmap.h>
-int main()
+int main(void)
{
// Define map with defered destruct
cmap_vi vecs = {0};
@@ -243,7 +243,7 @@ typedef struct { int x, y, z; } Vec3i;
#define i_tag iv
#include <stc/cmap.h>
-int main()
+int main(void)
{
cmap_iv vecs = {0}
@@ -304,7 +304,7 @@ static inline void Viking_drop(Viking* vk) {
#define i_val int
#include <stc/cmap.h>
-int main()
+int main(void)
{
// Use a HashMap to store the vikings' health points.
Vikings vikings = {0};
@@ -380,7 +380,7 @@ static inline RViking Viking_toraw(const Viking* vp) {
#define i_val int
#include <stc/cmap.h>
-int main()
+int main(void)
{
Vikings vikings = {0};
diff --git a/docs/cpque_api.md b/docs/cpque_api.md
index ca94e367..5b63dfd1 100644
--- a/docs/cpque_api.md
+++ b/docs/cpque_api.md
@@ -68,7 +68,7 @@ i_key cpque_X_value_clone(i_key value);
#define i_tag i
#include <stc/cpque.h>
-int main()
+int main(void)
{
intptr_t N = 10000000;
crand_t rng = crand_init(1234);
diff --git a/docs/cqueue_api.md b/docs/cqueue_api.md
index bce62833..b324e5fc 100644
--- a/docs/cqueue_api.md
+++ b/docs/cqueue_api.md
@@ -74,7 +74,7 @@ void cqueue_X_value_drop(cqueue_X_value* pval);
#include <stdio.h>
-int main() {
+int main(void) {
cqueue_i Q = cqueue_i_init();
// push() and pop() a few.
diff --git a/docs/crandom_api.md b/docs/crandom_api.md
index 74e23a6a..22a4f4dd 100644
--- a/docs/crandom_api.md
+++ b/docs/crandom_api.md
@@ -76,7 +76,7 @@ double crand_norm(crand_t* rng, crand_norm_t* dist);
#define i_tag i
#include <stc/csmap.h>
-int main()
+int main(void)
{
enum {N = 10000000};
const double Mean = -12.0, StdDev = 6.0, Scale = 74;
diff --git a/docs/cregex_api.md b/docs/cregex_api.md
index f87240f8..52476e09 100644
--- a/docs/cregex_api.md
+++ b/docs/cregex_api.md
@@ -102,7 +102,7 @@ If an error occurs ```cregex_compile``` returns a negative error code stored in
#define i_import // include dependent cstr, utf8 and cregex function definitions.
#include <stc/cregex.h>
-int main() {
+int main(void) {
const char* input = "start date is 2023-03-01, end date 2025-12-31.";
const char* pattern = "\\b(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)\\b";
diff --git a/docs/cset_api.md b/docs/cset_api.md
index 7bce3136..e894ad4f 100644
--- a/docs/cset_api.md
+++ b/docs/cset_api.md
@@ -83,7 +83,7 @@ cset_X_value cset_X_value_clone(cset_X_value val);
#define i_key_str
#include <stc/cset.h>
-int main ()
+int main(void)
{
Strset first, second={0}, third={0}, fourth={0}, fifth;
diff --git a/docs/csmap_api.md b/docs/csmap_api.md
index 2fd9f6a5..099d7dfc 100644
--- a/docs/csmap_api.md
+++ b/docs/csmap_api.md
@@ -108,7 +108,7 @@ void csmap_X_value_drop(csmap_X_value* pval);
#define i_val_str // ditto
#include <stc/csmap.h>
-int main()
+int main(void)
{
// Create a sorted map of three strings (maps to string)
csmap_str colors = c_init(csmap_str, {
@@ -166,7 +166,7 @@ static void print_result(strmap_result result) {
print_node(result.ref);
}
-int main()
+int main(void)
{
strmap m = {0};
@@ -191,7 +191,7 @@ This example uses a csmap with cstr as mapped value.
#define i_val_str
#include <stc/csmap.h>
-int main()
+int main(void)
{
uint32_t col = 0xcc7744ff;
IDSMap idnames = c_init(IDSMap, { {100, "Red"}, {110, "Blue"} });
@@ -237,7 +237,7 @@ static int Vec3i_cmp(const Vec3i* a, const Vec3i* b) {
#include <stc/csmap.h>
#include <stdio.h>
-int main()
+int main(void)
{
csmap_vi vmap = {0};
diff --git a/docs/cspan_api.md b/docs/cspan_api.md
index 1089e48d..09821450 100644
--- a/docs/cspan_api.md
+++ b/docs/cspan_api.md
@@ -101,7 +101,7 @@ if __name__ == '__main__':
#include <stc/cspan.h>
using_cspan3(myspan, int); // define myspan, myspan2, myspan3.
-int main() {
+int main(void) {
int arr[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24};
myspan3 ms3 = cspan_md(arr, 2, 3, 4); // C-order, i.e. row-major.
@@ -123,7 +123,7 @@ int main() {
#include <mdspan>
#include <tuple>
-int main() {
+int main(void) {
int arr[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24};
std::mdspan ms3(arr, 2, 3, 4);
@@ -147,7 +147,7 @@ Slicing cspan without and with reducing the rank:
using_cspan3(Span, int); // Shorthand to define Span, Span2, and Span3
-int main()
+int main(void)
{
// c_init() can create any STC container/span from an initializer list:
Span span = c_init(Span, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
diff --git a/docs/csset_api.md b/docs/csset_api.md
index d086b660..aef3af3c 100644
--- a/docs/csset_api.md
+++ b/docs/csset_api.md
@@ -83,7 +83,7 @@ csset_X_value csset_X_value_clone(csset_X_value val);
#define i_key_str
#include <stc/csset.h>
-int main ()
+int main(void)
{
SSet second={0}, third={0}, fourth={0}, fifth={0};
diff --git a/docs/cstack_api.md b/docs/cstack_api.md
index 51889d7f..e799b152 100644
--- a/docs/cstack_api.md
+++ b/docs/cstack_api.md
@@ -77,7 +77,7 @@ void cstack_X_value_drop(cvec_X_value* pval);
#include <stdio.h>
-int main() {
+int main(void) {
IStack stk = IStack_init();
for (int i=0; i < 100; ++i)
diff --git a/docs/cstr_api.md b/docs/cstr_api.md
index c7d19e0c..dae5669f 100644
--- a/docs/cstr_api.md
+++ b/docs/cstr_api.md
@@ -160,7 +160,7 @@ char* cstrnstrn(const char* str, const char* search, intptr_t slen, intpt
#define i_implement
#include <stc/cstr.h>
-int main() {
+int main(void) {
cstr s0, s1, full_path;
c_defer(
cstr_drop(&s0),
diff --git a/docs/csview_api.md b/docs/csview_api.md
index 33df6a64..79a5c07b 100644
--- a/docs/csview_api.md
+++ b/docs/csview_api.md
@@ -121,7 +121,7 @@ uint64_t csview_hash(const csview* x);
#include <stc/cstr.h>
#include <stc/csview.h>
-int main ()
+int main(void)
{
cstr str1 = cstr_lit("We think in generalities, but we live in details.");
// (quoting Alfred N. Whitehead)
@@ -151,7 +151,7 @@ red Apples
#define i_import // include dependent cstr, utf8 and cregex function definitions.
#include <stc/cstr.h>
-int main()
+int main(void)
{
cstr s1 = cstr_lit("hell😀 w😀rld");
@@ -198,7 +198,7 @@ cstack_str string_split(csview input, const char* sep)
return out;
}
-int main()
+int main(void)
{
print_split(c_sv("//This is a//double-slash//separated//string"), "//");
print_split(c_sv("This has no matching separator"), "xx");
diff --git a/docs/cvec_api.md b/docs/cvec_api.md
index ce85e446..d38ef23f 100644
--- a/docs/cvec_api.md
+++ b/docs/cvec_api.md
@@ -112,7 +112,7 @@ cvec_X_raw cvec_X_value_drop(cvec_X_value* pval);
#include <stdio.h>
-int main()
+int main(void)
{
// Create a vector containing integers
cvec_int vec = {0};
@@ -153,7 +153,7 @@ sorted: 5 7 8 13 16 25
#define i_key_str
#include <stc/cvec.h>
-int main() {
+int main(void) {
cvec_str names = cvec_str_init();
cvec_str_emplace(&names, "Mary");
diff --git a/include/c11/fmt.h b/include/c11/fmt.h
index 45044e33..d2eab8bc 100644
--- a/include/c11/fmt.h
+++ b/include/c11/fmt.h
@@ -33,7 +33,7 @@ void fmt_close(fmt_stream* ss);
#define FMT_SHORTS
#include "c11/fmt.h"
-int main() {
+int main(void) {
const double pi = 3.141592653589793;
const size_t x = 1234567890;
const char* string = "Hello world";
diff --git a/include/stc/algo/crange.h b/include/stc/algo/crange.h
index 45ef53a1..03162a2d 100644
--- a/include/stc/algo/crange.h
+++ b/include/stc/algo/crange.h
@@ -25,7 +25,7 @@
#include <stc/algo/filter.h>
#include <stc/algo/crange.h>
-int main()
+int main(void)
{
crange r1 = crange_make(80, 90);
c_foreach (i, crange, r1)
diff --git a/include/stc/algo/filter.h b/include/stc/algo/filter.h
index f5de1811..4a227927 100644
--- a/include/stc/algo/filter.h
+++ b/include/stc/algo/filter.h
@@ -26,7 +26,7 @@
#include <stc/cstack.h>
#include <stc/calgo.h>
-int main()
+int main(void)
{
cstack_int stk = c_init(cstack_int, {1, 2, 3, 4, 5, 6, 7, 8, 9});
diff --git a/include/stc/algo/sort.h b/include/stc/algo/sort.h
index 01e7d521..06d7395f 100644
--- a/include/stc/algo/sort.h
+++ b/include/stc/algo/sort.h
@@ -31,7 +31,7 @@ template params:
#define i_key int
#include <stc/algo/sort.h>
-int main() {
+int main(void) {
int nums[] = {23, 321, 5434, 25, 245, 1, 654, 33, 543, 21};
intarray_sort_n(nums, c_arraylen(nums));
@@ -48,7 +48,7 @@ int main() {
#include <stc/cdeq.h>
#include <stc/algo/sort.h>
-int main() {
+int main(void) {
IDeq nums = c_init(IDeq, {5434, 25, 245, 1, 654, 33, 543, 21});
IDeq_push_front(&nums, 23);
IDeq_push_front(&nums, 321);
diff --git a/include/stc/carc.h b/include/stc/carc.h
index b77b7dfb..9ba2ddd1 100644
--- a/include/stc/carc.h
+++ b/include/stc/carc.h
@@ -46,7 +46,7 @@ void Person_drop(Person* p) {
#define i_opt c_no_cmp|c_no_hash // exclude cmp, hash
#include <stc/carc.h>
-int main() {
+int main(void) {
ArcPers p = ArcPers_from(Person_make("John", "Smiths"));
ArcPers q = ArcPers_clone(p); // share the pointer
@@ -225,4 +225,4 @@ STC_INLINE void _cx_MEMB(_assign)(_cx_Self* self, _cx_Self ptr) {
#undef _i_atomic_inc
#undef _i_atomic_dec_and_test
#include "priv/template2.h"
-#undef _i_carc \ No newline at end of file
+#undef _i_carc
diff --git a/include/stc/cbits.h b/include/stc/cbits.h
index 66bc6354..3b5785d3 100644
--- a/include/stc/cbits.h
+++ b/include/stc/cbits.h
@@ -26,7 +26,7 @@ Similar to boost::dynamic_bitset / std::bitset
#include <stdio.h>
#include "cbits.h"
-int main() {
+int main(void) {
cbits bset = cbits_with_size(23, true);
cbits_reset(&bset, 9);
cbits_resize(&bset, 43, false);
diff --git a/include/stc/cbox.h b/include/stc/cbox.h
index 86d5a6a6..25d41b92 100644
--- a/include/stc/cbox.h
+++ b/include/stc/cbox.h
@@ -47,7 +47,7 @@ void Person_drop(Person* p) {
#define i_no_cmp // no cmp/hash is defined
#include <stc/cbox.h>
-int main() {
+int main(void) {
c_auto (PBox, p, q)
{
p = PBox_from(Person_from("John Smiths", "[email protected]"));
@@ -205,4 +205,4 @@ STC_INLINE void _cx_MEMB(_assign)(_cx_Self* self, _cx_Self* moved) {
{ return c_default_hash(&self->get); }
#endif
#include "priv/template2.h"
-#undef _i_cbox \ No newline at end of file
+#undef _i_cbox
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h
index 45c3a360..1f9ea80d 100644
--- a/include/stc/ccommon.h
+++ b/include/stc/ccommon.h
@@ -85,7 +85,7 @@ typedef long long _llong;
#define c_assert(expr) assert(expr)
#endif
#define c_container_of(p, C, m) ((C*)((char*)(1 ? (p) : &((C*)0)->m) - offsetof(C, m)))
-#define c_const_cast(T, p) ((T)(p) + 0*sizeof((T)0 == (p)))
+#define c_const_cast(T, p) ((T)(1 ? (p) : (T)0))
#define c_swap(T, xp, yp) do { T *_xp = xp, *_yp = yp, \
_tv = *_xp; *_xp = *_yp; *_yp = _tv; } while (0)
#define c_sizeof (intptr_t)sizeof
@@ -96,8 +96,8 @@ typedef long long _llong;
#define c_memmove(d, s, ilen) memmove(d, s, c_i2u(ilen))
#define c_memset(d, val, ilen) memset(d, val, c_i2u(ilen))
#define c_memcmp(a, b, ilen) memcmp(a, b, c_i2u(ilen))
-#define c_u2i(u) ((intptr_t)((u) + 0*sizeof((u) == 1U)))
-#define c_i2u(i) ((size_t)(i) + 0*sizeof((i) == 1))
+#define c_u2i(u) ((intptr_t)(1 ? (u) : (size_t)1))
+#define c_i2u(i) ((size_t)(1 ? (i) : (intptr_t)1))
#define c_LTu(a, b) ((size_t)(a) < (size_t)(b))
// x and y are i_keyraw* type, defaults to i_key*:
diff --git a/include/stc/clist.h b/include/stc/clist.h
index 9cc1bb39..d7cf30b9 100644
--- a/include/stc/clist.h
+++ b/include/stc/clist.h
@@ -32,7 +32,7 @@
#define i_tag ix
#include <stc/clist.h>
- int main()
+ int main(void)
{
c_auto (clist_ix, list)
{
diff --git a/include/stc/crand.h b/include/stc/crand.h
index 89b681cd..0a6aa9e0 100644
--- a/include/stc/crand.h
+++ b/include/stc/crand.h
@@ -29,7 +29,7 @@
// crand: Pseudo-random number generator
#include "stc/crand.h"
-int main() {
+int main(void) {
uint64_t seed = 123456789;
crand_t rng = crand_init(seed);
crand_unif_t dist1 = crand_unif_init(1, 6);
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index 9b95306e..d08e382f 100644
--- a/include/stc/cvec.h
+++ b/include/stc/cvec.h
@@ -44,7 +44,7 @@ struct MyStruct {
#define i_tag i32
#include <stc/cvec.h>
-int main() {
+int main(void) {
cvec_i32 vec = {0};
cvec_i32_push(&vec, 123);
cvec_i32_drop(&vec);
diff --git a/misc/benchmarks/plotbench/cpque_benchmark.cpp b/misc/benchmarks/plotbench/cpque_benchmark.cpp
index 2d4c7a28..6c62ae3e 100644
--- a/misc/benchmarks/plotbench/cpque_benchmark.cpp
+++ b/misc/benchmarks/plotbench/cpque_benchmark.cpp
@@ -58,7 +58,7 @@ void stc_test()
}
-int main()
+int main(void)
{
puts("STD P.QUEUE:");
std_test();
diff --git a/misc/benchmarks/various/cspan_bench.c b/misc/benchmarks/various/cspan_bench.c
index 392c9d3f..e3997ff0 100644
--- a/misc/benchmarks/various/cspan_bench.c
+++ b/misc/benchmarks/various/cspan_bench.c
@@ -114,7 +114,7 @@ static void MDRanges_loop_over_joined(intptr_t state)
printf("joined: %.1f ms, %f\n", 1000.0f * t / CLOCKS_PER_SEC, sum);
}
-int main()
+int main(void)
{
for (int i = 0; i < nx * ny * nz; ++i)
Vin[i] = i + 1.23;
diff --git a/misc/benchmarks/various/rust_cmap.c b/misc/benchmarks/various/rust_cmap.c
index abdb42b0..97047e0b 100644
--- a/misc/benchmarks/various/rust_cmap.c
+++ b/misc/benchmarks/various/rust_cmap.c
@@ -22,7 +22,7 @@ uint64_t romu_trio(uint64_t s[3]) {
return xp;
}
-int main()
+int main(void)
{
cmap_u64 m = {0};
diff --git a/misc/benchmarks/various/sso_bench.cpp b/misc/benchmarks/various/sso_bench.cpp
index 6d3d107a..244c1291 100644
--- a/misc/benchmarks/various/sso_bench.cpp
+++ b/misc/benchmarks/various/sso_bench.cpp
@@ -112,7 +112,7 @@ int benchmark_lookup(C& container, const int n, const int strsize) {
}
#include <time.h>
-int main() {
+int main(void) {
uint64_t seed = time(NULL); // 4321;
int sum, n;
diff --git a/misc/benchmarks/various/string_bench_STC.cpp b/misc/benchmarks/various/string_bench_STC.cpp
index 319b0b19..a5dfd901 100644
--- a/misc/benchmarks/various/string_bench_STC.cpp
+++ b/misc/benchmarks/various/string_bench_STC.cpp
@@ -184,7 +184,7 @@ void benchmark(
//const size_t MAX_LOOP = 1000000;
const size_t MAX_LOOP = 2000;
-int main()
+int main(void)
{
c_auto (cvec_str, vec_string)
c_auto (cvec_sv, vec_stringview)
diff --git a/misc/benchmarks/various/string_bench_STD.cpp b/misc/benchmarks/various/string_bench_STD.cpp
index 07934948..153ac02f 100644
--- a/misc/benchmarks/various/string_bench_STD.cpp
+++ b/misc/benchmarks/various/string_bench_STD.cpp
@@ -194,7 +194,7 @@ void benchmark(
//const size_t MAX_LOOP = 1000000;
const size_t MAX_LOOP = 2000;
-int main()
+int main(void)
{
std::vector<std::string> vec_shortstr;
std::vector<std::string_view> vec_shortstrview;
diff --git a/misc/examples/arc_containers.c b/misc/examples/arc_containers.c
index 524758e7..2fb04c56 100644
--- a/misc/examples/arc_containers.c
+++ b/misc/examples/arc_containers.c
@@ -24,7 +24,7 @@
#define i_keyboxed Arc // as above
#include <stc/clist.h>
-int main()
+int main(void)
{
Stack stack = {0};
List list = {0};
diff --git a/misc/examples/arc_demo.c b/misc/examples/arc_demo.c
index 547e1737..87d64e67 100644
--- a/misc/examples/arc_demo.c
+++ b/misc/examples/arc_demo.c
@@ -20,7 +20,7 @@ void int_drop(int* x) {
#define i_keyboxed Arc // note: as above.
#include <stc/cvec.h> // cvec_Arc (like: std::vector<std::shared_ptr<int>>)
-int main()
+int main(void)
{
const int years[] = {2021, 2012, 2022, 2015};
diff --git a/misc/examples/arcvec_erase.c b/misc/examples/arcvec_erase.c
index f409258b..addef8b7 100644
--- a/misc/examples/arcvec_erase.c
+++ b/misc/examples/arcvec_erase.c
@@ -13,7 +13,7 @@ void show_drop(int* x) { printf("drop: %d\n", *x); }
#include <stc/cvec.h> // Vec: cvec<Arc>
-int main()
+int main(void)
{
Vec vec = c_init(Vec, {2012, 1990, 2012, 2019, 2015});
diff --git a/misc/examples/birthday.c b/misc/examples/birthday.c
index 2820c42f..4742cb45 100644
--- a/misc/examples/birthday.c
+++ b/misc/examples/birthday.c
@@ -60,7 +60,7 @@ void test_distribution(void)
cmap_x_drop(&map);
}
-int main()
+int main(void)
{
seed = (uint64_t)time(NULL);
test_distribution();
diff --git a/misc/examples/bits2.c b/misc/examples/bits2.c
index 913bd185..de2f16f4 100644
--- a/misc/examples/bits2.c
+++ b/misc/examples/bits2.c
@@ -5,7 +5,7 @@
#define i_capacity 80 // enable fixed bitset on the stack
#include <stc/cbits.h>
-int main()
+int main(void)
{
Bits s1 = Bits_from("1110100110111");
diff --git a/misc/examples/books.c b/misc/examples/books.c
index 7f0660b8..1fd57f27 100644
--- a/misc/examples/books.c
+++ b/misc/examples/books.c
@@ -7,7 +7,7 @@
// Type inference lets us omit an explicit type signature (which
// would be `HashMap<String, String>` in this example).
-int main()
+int main(void)
{
cmap_str book_reviews = {0};
diff --git a/misc/examples/box.c b/misc/examples/box.c
index 3f55e15d..94d126c0 100644
--- a/misc/examples/box.c
+++ b/misc/examples/box.c
@@ -36,7 +36,7 @@ void Person_drop(Person* p) {
#define i_keyboxed PBox // "arcbox" informs that PBox is a smart pointer.
#include <stc/csset.h>
-int main()
+int main(void)
{
Persons vec = {0};
PBox p = PBox_from(Person_make("Laura", "Palmer"));
diff --git a/misc/examples/cointerleave.c b/misc/examples/cointerleave.c
index c3c5926a..599ceaab 100644
--- a/misc/examples/cointerleave.c
+++ b/misc/examples/cointerleave.c
@@ -56,7 +56,7 @@ void Use(void)
c_drop(IVec, &a, &b);
}
-int main()
+int main(void)
{
Use();
}
diff --git a/misc/examples/complex.c b/misc/examples/complex.c
index 405afef3..4eb1574b 100644
--- a/misc/examples/complex.c
+++ b/misc/examples/complex.c
@@ -28,7 +28,7 @@
#include <stc/cmap.h>
-int main()
+int main(void)
{
MapMap mmap = {0};
diff --git a/misc/examples/convert.c b/misc/examples/convert.c
index 3f2f60f6..fa64560e 100644
--- a/misc/examples/convert.c
+++ b/misc/examples/convert.c
@@ -11,7 +11,7 @@
#define i_key_str
#include <stc/clist.h>
-int main()
+int main(void)
{
cmap_str map, mclone;
cvec_str keys = {0}, values = {0};
diff --git a/misc/examples/csmap_erase.c b/misc/examples/csmap_erase.c
index 9433d370..8d4eeae3 100644
--- a/misc/examples/csmap_erase.c
+++ b/misc/examples/csmap_erase.c
@@ -16,7 +16,7 @@ void printmap(mymap m)
printf("\nsize() == %" c_ZI "\n\n", mymap_size(&m));
}
-int main()
+int main(void)
{
mymap m1 = {0};
diff --git a/misc/examples/csmap_find.c b/misc/examples/csmap_find.c
index b535e9ad..c392338d 100644
--- a/misc/examples/csmap_find.c
+++ b/misc/examples/csmap_find.c
@@ -40,7 +40,7 @@ void findit(csmap_istr c, csmap_istr_key val)
}
}
-int main()
+int main(void)
{
csmap_istr m1 = c_init(csmap_istr, {{40, "Zr"}, {45, "Rh"}});
cvec_istr v = {0};
diff --git a/misc/examples/csmap_insert.c b/misc/examples/csmap_insert.c
index df638c22..c9f02891 100644
--- a/misc/examples/csmap_insert.c
+++ b/misc/examples/csmap_insert.c
@@ -29,7 +29,7 @@ void print_istr(csmap_istr map) {
puts("");
}
-int main()
+int main(void)
{
// insert single values
csmap_ii m1 = {0};
diff --git a/misc/examples/csset_erase.c b/misc/examples/csset_erase.c
index 649bb1e3..9c7f5e1a 100644
--- a/misc/examples/csset_erase.c
+++ b/misc/examples/csset_erase.c
@@ -3,7 +3,7 @@
#define i_key int
#include <stc/csset.h>
-int main()
+int main(void)
{
csset_int set = c_init(csset_int, {30, 20, 80, 40, 60, 90, 10, 70, 50});
diff --git a/misc/examples/cstr_match.c b/misc/examples/cstr_match.c
index 10a843cf..be03e981 100644
--- a/misc/examples/cstr_match.c
+++ b/misc/examples/cstr_match.c
@@ -3,7 +3,7 @@
#include <stc/csview.h>
#include <stdio.h>
-int main()
+int main(void)
{
cstr ss = cstr_lit("The quick brown fox jumps over the lazy dog.JPG");
diff --git a/misc/examples/demos.c b/misc/examples/demos.c
index 2e91b20c..ecc89f2e 100644
--- a/misc/examples/demos.c
+++ b/misc/examples/demos.c
@@ -1,7 +1,7 @@
#define i_implement
#include <stc/cstr.h>
-void stringdemo1()
+void stringdemo1(void)
{
cstr cs = cstr_lit("one-nine-three-seven-five");
printf("%s.\n", cstr_str(&cs));
@@ -32,7 +32,7 @@ void stringdemo1()
#define i_tag ix
#include <stc/cvec.h>
-void vectordemo1()
+void vectordemo1(void)
{
cvec_ix bignums = cvec_ix_with_capacity(100);
cvec_ix_reserve(&bignums, 100);
@@ -55,7 +55,7 @@ void vectordemo1()
#define i_key_str
#include <stc/cvec.h>
-void vectordemo2()
+void vectordemo2(void)
{
cvec_str names = {0};
cvec_str_emplace_back(&names, "Mary");
@@ -77,7 +77,7 @@ void vectordemo2()
#define i_native_cmp
#include <stc/clist.h>
-void listdemo1()
+void listdemo1(void)
{
clist_ix nums = {0}, nums2 = {0};
for (int i = 0; i < 10; ++i)
@@ -109,7 +109,7 @@ void listdemo1()
#define i_tag i
#include <stc/cset.h>
-void setdemo1()
+void setdemo1(void)
{
cset_i nums = {0};
cset_i_insert(&nums, 8);
@@ -125,7 +125,7 @@ void setdemo1()
#define i_tag ii
#include <stc/cmap.h>
-void mapdemo1()
+void mapdemo1(void)
{
cmap_ii nums = {0};
cmap_ii_insert(&nums, 8, 64);
@@ -139,7 +139,7 @@ void mapdemo1()
#define i_tag si
#include <stc/cmap.h>
-void mapdemo2()
+void mapdemo2(void)
{
cmap_si nums = {0};
cmap_si_emplace_or_assign(&nums, "Hello", 64);
@@ -161,7 +161,7 @@ void mapdemo2()
#define i_val_str
#include <stc/cmap.h>
-void mapdemo3()
+void mapdemo3(void)
{
cmap_str table = {0};
cmap_str_emplace(&table, "Map", "test");
@@ -181,7 +181,7 @@ void mapdemo3()
cmap_str_drop(&table); // frees key and value cstrs, and hash table.
}
-int main()
+int main(void)
{
printf("\nSTRINGDEMO1\n"); stringdemo1();
printf("\nVECTORDEMO1\n"); vectordemo1();
diff --git a/misc/examples/dining_philosophers.c b/misc/examples/dining_philosophers.c
index 61fe67fb..a5063a42 100644
--- a/misc/examples/dining_philosophers.c
+++ b/misc/examples/dining_philosophers.c
@@ -86,7 +86,7 @@ int dining(struct Dining* d)
return 0;
}
-int main()
+int main(void)
{
struct Dining dine;
cco_reset(&dine);
diff --git a/misc/examples/forloops.c b/misc/examples/forloops.c
index 99b12871..47cced8f 100644
--- a/misc/examples/forloops.c
+++ b/misc/examples/forloops.c
@@ -11,7 +11,7 @@
#include <stc/cmap.h>
-int main()
+int main(void)
{
puts("c_forrange:");
c_forrange (30) printf(" xx");
diff --git a/misc/examples/functor.c b/misc/examples/functor.c
index ea409a56..e3bde1dd 100644
--- a/misc/examples/functor.c
+++ b/misc/examples/functor.c
@@ -30,7 +30,7 @@ static bool int_less(const int* x, const int* y) { return *x < *y; }
static bool int_greater(const int* x, const int* y) { return *x > *y; }
static bool int_lambda(const int* x, const int* y) { return (*x ^ 1) < (*y ^ 1); }
-int main()
+int main(void)
{
const int data[] = {1,8,5,6,3,4,0,9,7,2}, n = c_arraylen(data);
printf("data: \t");
diff --git a/misc/examples/gauss2.c b/misc/examples/gauss2.c
index 67586181..1ab8ade5 100644
--- a/misc/examples/gauss2.c
+++ b/misc/examples/gauss2.c
@@ -10,7 +10,7 @@
#define i_val int
#include <stc/csmap.h>
-int main()
+int main(void)
{
enum {N = 5000000};
uint64_t seed = (uint64_t)time(NULL);
diff --git a/misc/examples/generator.c b/misc/examples/generator.c
index 3ff7a645..a15f9ba5 100644
--- a/misc/examples/generator.c
+++ b/misc/examples/generator.c
@@ -42,7 +42,7 @@ Triple_iter Triple_begin(Triple* g) {
}
-int main()
+int main(void)
{
puts("Pythagorean triples with c < 100:");
Triple triple = {.size=30}; // max number of triples
diff --git a/misc/examples/intrusive.c b/misc/examples/intrusive.c
index 1e3f7b83..4fca654b 100644
--- a/misc/examples/intrusive.c
+++ b/misc/examples/intrusive.c
@@ -14,7 +14,7 @@ void printList(List list) {
puts("");
}
-int main() {
+int main(void) {
List list = {0};
c_forlist (i, int, {6, 9, 3, 1, 7, 4, 5, 2, 8})
List_push_back_node(&list, c_new(List_node, {0, *i.ref}));
diff --git a/misc/examples/list.c b/misc/examples/list.c
index a0045db9..fa33305a 100644
--- a/misc/examples/list.c
+++ b/misc/examples/list.c
@@ -8,7 +8,7 @@
#define i_native_cmp
#include <stc/clist.h>
-int main() {
+int main(void) {
const int n = 3000000;
DList list = {0};
diff --git a/misc/examples/list_erase.c b/misc/examples/list_erase.c
index 357dd75b..211c5a5d 100644
--- a/misc/examples/list_erase.c
+++ b/misc/examples/list_erase.c
@@ -5,7 +5,7 @@
#define i_key int
#include <stc/clist.h>
-int main ()
+int main(void)
{
IList L = c_init(IList, {10, 20, 30, 40, 50});
diff --git a/misc/examples/list_splice.c b/misc/examples/list_splice.c
index 25c2a42d..f1fd6e1f 100644
--- a/misc/examples/list_splice.c
+++ b/misc/examples/list_splice.c
@@ -13,7 +13,7 @@ void print_ilist(const char* s, clist_i list)
puts("");
}
-int main ()
+int main(void)
{
clist_i list1 = c_init(clist_i, {1, 2, 3, 4, 5});
clist_i list2 = c_init(clist_i, {10, 20, 30, 40, 50});
diff --git a/misc/examples/lower_bound.c b/misc/examples/lower_bound.c
index ee32f49b..e5d816e9 100644
--- a/misc/examples/lower_bound.c
+++ b/misc/examples/lower_bound.c
@@ -7,7 +7,7 @@
#define i_key int
#include <stc/csset.h>
-int main()
+int main(void)
{
// TEST SORTED VECTOR
{
diff --git a/misc/examples/mmap.c b/misc/examples/mmap.c
index fd00499c..04a605a7 100644
--- a/misc/examples/mmap.c
+++ b/misc/examples/mmap.c
@@ -30,7 +30,7 @@ void insert(Multimap* mmap, int key, const char* str)
clist_str_emplace_back(list, str);
}
-int main()
+int main(void)
{
Multimap mmap = {0};
diff --git a/misc/examples/multidim.c b/misc/examples/multidim.c
index 45b97378..798a1126 100644
--- a/misc/examples/multidim.c
+++ b/misc/examples/multidim.c
@@ -6,7 +6,7 @@
using_cspan3(ispan, int);
-int main()
+int main(void)
{
cstack_int v = c_init(cstack_int, {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24});
diff --git a/misc/examples/multimap.c b/misc/examples/multimap.c
index a89b251b..1068a5dc 100644
--- a/misc/examples/multimap.c
+++ b/misc/examples/multimap.c
@@ -66,7 +66,7 @@ void OlympicLoc_drop(OlympicLoc* self) {
}
-int main()
+int main(void)
{
// Define the multimap with destructor defered to when block is completed.
csmap_OL multimap = {0};
diff --git a/misc/examples/music_arc.c b/misc/examples/music_arc.c
index 49008523..16111b0b 100644
--- a/misc/examples/music_arc.c
+++ b/misc/examples/music_arc.c
@@ -31,7 +31,7 @@ void Song_drop(Song* s) {
#define i_keyboxed SongArc // use i_keyboxed on carc / cbox (instead of i_key)
#include <stc/cvec.h>
-void example3()
+void example3(void)
{
SongVec vec1 = c_init(SongVec, {
Song_make("Bob Dylan", "The Times They Are A Changing"),
@@ -61,7 +61,7 @@ void example3()
c_drop(SongVec, &vec1, &vec2);
}
-int main()
+int main(void)
{
example3();
}
diff --git a/misc/examples/new_list.c b/misc/examples/new_list.c
index ee250b2b..9676e7b4 100644
--- a/misc/examples/new_list.c
+++ b/misc/examples/new_list.c
@@ -43,7 +43,7 @@ void MyStruct_drop(MyStruct* s) {
}
-int main()
+int main(void)
{
MyStruct my = {0};
clist_i32_push_back(&my.intlist, 123);
diff --git a/misc/examples/new_map.c b/misc/examples/new_map.c
index 277bcbc2..de990040 100644
--- a/misc/examples/new_map.c
+++ b/misc/examples/new_map.c
@@ -41,7 +41,7 @@ int point_cmp(const Point* a, const Point* b) {
#include <stc/cset.h>
-int main()
+int main(void)
{
cmap_pnt pmap = c_init(cmap_pnt, {{{42, 14}, 1}, {{32, 94}, 2}, {{62, 81}, 3}});
diff --git a/misc/examples/new_pque.c b/misc/examples/new_pque.c
index 3df39e0e..16823bb6 100644
--- a/misc/examples/new_pque.c
+++ b/misc/examples/new_pque.c
@@ -8,7 +8,7 @@ typedef struct Point { int x, y; } Point;
#include <stc/cpque.h>
-int main()
+int main(void)
{
PointQ pque = c_init(PointQ, {{23, 80}, {12, 32}, {54, 74}, {12, 62}});
// print
diff --git a/misc/examples/new_queue.c b/misc/examples/new_queue.c
index 104871bf..f3592df6 100644
--- a/misc/examples/new_queue.c
+++ b/misc/examples/new_queue.c
@@ -20,7 +20,7 @@ int point_cmp(const Point* a, const Point* b) {
#define i_key int
#include <stc/cqueue.h>
-int main() {
+int main(void) {
int n = 50000000;
crand_t rng = crand_init((uint64_t)time(NULL));
crand_unif_t dist = crand_unif_init(0, n);
diff --git a/misc/examples/new_smap.c b/misc/examples/new_smap.c
index 77c4cdce..ee946c9a 100644
--- a/misc/examples/new_smap.c
+++ b/misc/examples/new_smap.c
@@ -36,7 +36,7 @@ int point_cmp(const Point* a, const Point* b) {
#include <stc/csset.h>
-int main()
+int main(void)
{
PMap pmap = c_init(PMap, {
{{42, 14}, 1},
diff --git a/misc/examples/new_vec.c b/misc/examples/new_vec.c
index 6d928cfc..88efd55a 100644
--- a/misc/examples/new_vec.c
+++ b/misc/examples/new_vec.c
@@ -23,7 +23,7 @@ typedef struct Point { int x, y; } Point;
#define i_is_forward
#include <stc/cvec.h>
-int main()
+int main(void)
{
MyStruct my = {0};
diff --git a/misc/examples/person_arc.c b/misc/examples/person_arc.c
index 3a759610..38c883a7 100644
--- a/misc/examples/person_arc.c
+++ b/misc/examples/person_arc.c
@@ -39,7 +39,7 @@ void Person_drop(Person* p) {
#include <stc/cvec.h>
-int main()
+int main(void)
{
PSPtr p = PSPtr_from(Person_make("Laura", "Palmer"));
PSPtr q = PSPtr_from(Person_clone(*p.get)); // deep copy
diff --git a/misc/examples/printspan.c b/misc/examples/printspan.c
index 5084536a..cd3c5f4f 100644
--- a/misc/examples/printspan.c
+++ b/misc/examples/printspan.c
@@ -20,7 +20,7 @@ void printMe(intspan container) {
puts("");
}
-int main()
+int main(void)
{
intspan sp1 = cspan_init(intspan, {1, 2});
printMe( sp1 );
diff --git a/misc/examples/priority.c b/misc/examples/priority.c
index 148e8fc5..bf2e188a 100644
--- a/misc/examples/priority.c
+++ b/misc/examples/priority.c
@@ -8,7 +8,7 @@
#define i_tag i
#include <stc/cpque.h>
-int main() {
+int main(void) {
intptr_t N = 10000000;
crand_t rng = crand_init((uint64_t)time(NULL));
crand_unif_t dist = crand_unif_init(0, N * 10);
diff --git a/misc/examples/queue.c b/misc/examples/queue.c
index 3154f115..56b5beb9 100644
--- a/misc/examples/queue.c
+++ b/misc/examples/queue.c
@@ -5,7 +5,7 @@
#define i_tag i
#include <stc/cqueue.h>
-int main() {
+int main(void) {
int n = 100000000;
crand_unif_t dist;
crand_t rng = crand_init(1234);
diff --git a/misc/examples/random.c b/misc/examples/random.c
index e783fe55..b7c0f277 100644
--- a/misc/examples/random.c
+++ b/misc/examples/random.c
@@ -2,7 +2,7 @@
#include <time.h>
#include <stc/crand.h>
-int main()
+int main(void)
{
const int N = 1000000000;
const uint64_t seed = (uint64_t)time(NULL), range = 1000000;
diff --git a/misc/examples/rawptr_elements.c b/misc/examples/rawptr_elements.c
index 9c394d8e..694ce12e 100644
--- a/misc/examples/rawptr_elements.c
+++ b/misc/examples/rawptr_elements.c
@@ -25,7 +25,7 @@
#define i_valboxed IBox // i_valboxed: use properties from IBox automatically
#include <stc/cmap.h>
-int main()
+int main(void)
{
// These have the same behaviour, except IBox has a get member:
SIPtrMap map1 = {0};
diff --git a/misc/examples/read.c b/misc/examples/read.c
index c25cd740..b12f7409 100644
--- a/misc/examples/read.c
+++ b/misc/examples/read.c
@@ -15,7 +15,7 @@ cvec_str read_file(const char* name)
return vec;
}
-int main()
+int main(void)
{
int n = 0;
c_with (cvec_str vec = read_file(__FILE__), cvec_str_drop(&vec))
diff --git a/misc/examples/regex2.c b/misc/examples/regex2.c
index 734190cb..a798b1a1 100644
--- a/misc/examples/regex2.c
+++ b/misc/examples/regex2.c
@@ -1,7 +1,7 @@
#define i_import
#include <stc/cregex.h>
-int main()
+int main(void)
{
struct { const char *pattern, *input; } s[] = {
{"(\\d\\d\\d\\d)[-_](1[0-2]|0[1-9])[-_](3[01]|[12][0-9]|0[1-9])",
diff --git a/misc/examples/regex_match.c b/misc/examples/regex_match.c
index 88d3747b..11426d2d 100644
--- a/misc/examples/regex_match.c
+++ b/misc/examples/regex_match.c
@@ -6,7 +6,7 @@
#define i_key float
#include <stc/cstack.h>
-int main()
+int main(void)
{
// Lets find the first sequence of digits in a string
const char *str = "Hello numeric world, there are 24 hours in a day, 3600 seconds in an hour."
diff --git a/misc/examples/regex_replace.c b/misc/examples/regex_replace.c
index 76664b1b..f1ea2711 100644
--- a/misc/examples/regex_replace.c
+++ b/misc/examples/regex_replace.c
@@ -12,7 +12,7 @@ bool add_10_years(int i, csview match, cstr* out) {
return false;
}
-int main()
+int main(void)
{
const char* pattern = "\\b(\\d\\d\\d\\d)-(1[0-2]|0[1-9])-(3[01]|[12][0-9]|0[1-9])\\b";
const char* input = "start date: 2015-12-31, end date: 2022-02-28";
diff --git a/misc/examples/replace.c b/misc/examples/replace.c
index 9ac26c07..59a56bf7 100644
--- a/misc/examples/replace.c
+++ b/misc/examples/replace.c
@@ -1,7 +1,7 @@
#define i_implement
#include <stc/cstr.h>
-int main ()
+int main(void)
{
const char *base = "this is a test string.";
const char *s2 = "n example";
diff --git a/misc/examples/scheduler.c b/misc/examples/scheduler.c
index d812ff42..38defd0f 100644
--- a/misc/examples/scheduler.c
+++ b/misc/examples/scheduler.c
@@ -68,7 +68,7 @@ void Use(void)
Scheduler_drop(&scheduler);
}
-int main()
+int main(void)
{
Use();
}
diff --git a/misc/examples/sidebyside.cpp b/misc/examples/sidebyside.cpp
index a7c1008c..9414b691 100644
--- a/misc/examples/sidebyside.cpp
+++ b/misc/examples/sidebyside.cpp
@@ -13,7 +13,7 @@
#define i_val int
#include <stc/cmap.h>
-int main() {
+int main(void) {
{
std::map<int, int> hist;
hist.emplace(12, 100).first->second += 1;
diff --git a/misc/examples/sorted_map.c b/misc/examples/sorted_map.c
index ff727632..89381554 100644
--- a/misc/examples/sorted_map.c
+++ b/misc/examples/sorted_map.c
@@ -5,7 +5,7 @@
#define i_val int
#include <stc/csmap.h>
-int main()
+int main(void)
{
// empty map containers
diff --git a/misc/examples/splitstr.c b/misc/examples/splitstr.c
index 32b5f17f..ef7ed174 100644
--- a/misc/examples/splitstr.c
+++ b/misc/examples/splitstr.c
@@ -4,7 +4,7 @@
#define i_implement
#include <stc/csview.h>
-int main()
+int main(void)
{
puts("Split with c_fortoken (csview):");
diff --git a/misc/examples/sso_map.c b/misc/examples/sso_map.c
index b78dcb2e..4f84b651 100644
--- a/misc/examples/sso_map.c
+++ b/misc/examples/sso_map.c
@@ -4,7 +4,7 @@
#define i_val_str
#include <stc/cmap.h>
-int main()
+int main(void)
{
cmap_str m = {0};
cmap_str_emplace(&m, "Test short", "This is a short string");
diff --git a/misc/examples/sso_substr.c b/misc/examples/sso_substr.c
index 9b062eed..687658df 100644
--- a/misc/examples/sso_substr.c
+++ b/misc/examples/sso_substr.c
@@ -3,7 +3,7 @@
#define i_implement
#include <stc/csview.h>
-int main ()
+int main(void)
{
cstr str = cstr_lit("We think in generalities, but we live in details.");
csview sv1 = cstr_substr_ex(&str, 3, 5); // "think"
diff --git a/misc/examples/stack.c b/misc/examples/stack.c
index 96bab24b..6297fb6f 100644
--- a/misc/examples/stack.c
+++ b/misc/examples/stack.c
@@ -10,7 +10,7 @@
#define i_key char
#include <stc/cstack.h>
-int main() {
+int main(void) {
cstack_i stack = {0};
cstack_c chars = {0};
diff --git a/misc/examples/sview_split.c b/misc/examples/sview_split.c
index 782e4096..ac275da0 100644
--- a/misc/examples/sview_split.c
+++ b/misc/examples/sview_split.c
@@ -3,7 +3,7 @@
#define i_implement
#include <stc/csview.h>
-int main()
+int main(void)
{
// No memory allocations or string length calculations!
const csview date = c_sv("2021/03/12");
diff --git a/misc/examples/triples.c b/misc/examples/triples.c
index a8ca6b47..9f2fcc1e 100644
--- a/misc/examples/triples.c
+++ b/misc/examples/triples.c
@@ -52,7 +52,7 @@ int triples_coro(struct triples* t) {
return 0;
}
-int main()
+int main(void)
{
puts("Vanilla triples:");
triples_vanilla(5);
diff --git a/misc/examples/unordered_set.c b/misc/examples/unordered_set.c
index 14d69ce5..dd899d78 100644
--- a/misc/examples/unordered_set.c
+++ b/misc/examples/unordered_set.c
@@ -5,7 +5,7 @@
#define i_key_str
#include <stc/cset.h>
-int main()
+int main(void)
{
// declaring set for storing string data-type
cset_str stringSet = {0};
diff --git a/misc/examples/utf8replace_c.c b/misc/examples/utf8replace_c.c
index 17352fee..1d54486f 100644
--- a/misc/examples/utf8replace_c.c
+++ b/misc/examples/utf8replace_c.c
@@ -1,7 +1,7 @@
#define i_implement
#include <stc/cstr.h>
-int main()
+int main(void)
{
cstr hello = cstr_lit("hell😀 w😀rld");
printf("%s\n", cstr_str(&hello));
diff --git a/misc/examples/vikings.c b/misc/examples/vikings.c
index d9024052..d6125854 100644
--- a/misc/examples/vikings.c
+++ b/misc/examples/vikings.c
@@ -41,7 +41,7 @@ static inline RViking Viking_toraw(const Viking* vp) {
#define i_val int // mapped type
#include <stc/cmap.h>
-int main()
+int main(void)
{
Vikings vikings = {0};
Vikings_emplace(&vikings, c_LITERAL(RViking){"Einar", "Norway"}, 20);