MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

lib_acl_cpp/samples/string/string3/main.cpp:40–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40int main(void)
41{
42 if (0)
43 for (int i = 0; i < 100; i++)
44 test();
45
46 acl::string b(20);
47 size_t size = b.capacity();
48 for (int i = (int) size - 1; i >= 0; i--)
49 {
50 b[i] = '1';
51 }
52 b[b.capacity()] = '\0';
53 printf("cap: %d\n", (int) size);
54
55 printf("---------------------------------------------------\n");
56
57 size = b.capacity();
58 printf("cap11: %d\n", (int) size);
59 for (int i = 0; i < (int) size; i++)
60 b[i] = '2';
61 size = b.capacity();
62 printf("cap12: %d\n", (int) size);
63
64 printf("---------------------------------------------------\n");
65
66 size = b.capacity();
67 printf("cap20: %d\n", (int) size);
68
69 b[b.capacity()] = '\0';
70 size = b.capacity();
71 printf("cap21: %d\n", (int) size);
72
73 for (int i = 0; i < (int) size; i++)
74 {
75 b[i] = '2';
76 printf("capxx22: %d\n", (int) b.capacity());
77 }
78 size = b.capacity();
79 printf("cap22: %d\n", (int) size);
80
81 printf("---------------------------------------------------\n");
82
83 b[b.capacity()] = '\0';
84 size = b.capacity();
85 printf("cap31: %d\n", (int) size);
86
87 for (int i = 0; i < (int) size; i++)
88 b[i] = '3';
89 size = b.capacity();
90 printf("cap32: %d\n", (int) size);
91 b[size + 1] = '\0';
92 b[size + 2] = '\0';
93 b[size + 3] = '\0';
94 size = b.capacity();
95 printf("cap33: %d\n", (int) size);
96
97 printf("buf: %s, len: %d, cap: %d\r\n",

Callers

nothing calls this directly

Calls 4

capacityMethod · 0.80
testFunction · 0.70
c_strMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…