C∀ Collection Library
| dc.contributor.author | Brooks, Michael | |
| dc.date.accessioned | 2026-10-15T18:38:19Z | |
| dc.date.issued | 2026-10-15 | |
| dc.date.submitted | 2026-10-08 | |
| dc.description.abstract | C∀ strives to fix issues in C, chief among them safety. This thesis presents a significant step forward in C∀’s goal to remove unsafe pointer operations. It describes improvements to the C∀ language design to support advanced collection features. These features are implemented across the C∀ compiler and runtime libraries. The results maintain another C∀ goal of offering strong backwards compatibility with C. To achieve these goals, this work leverages preexisting C∀ contributions by prior students, particularly novel applications of the compiler’s type system. Modern programming languages accommodate needs for these three high-level collections (containers): array, linked-list, and string. For all three types, languages and/or their libraries supply varying degrees of high-level mechanisms for manipulating these objects at the bulk and component levels, such as copying, slicing, extracting, and iterating among elements. Unfortunately, typical implementations for the these key types in C cause 60%–70% of the reported software vulnerabilities involving memory errors, where 70%–80% of hacker attack vectors target these types. Therefore, hardening these three C types and suggesting programmers use them as their default types goes a long way to increase memory safety in the majority of C programs. Specifically, an array is provided that tracks its length internally, relieving the user and implementor from managing explicit length arguments/parameters and stopping buffer-overrun errors. This feature requires augmenting the C∀ type system, making array length available at compile and runtime. A linked-list utility is provided that obviates many user-managed recursive pointers, while catering directly to system-programming using intrusive linking. Finally, a string utility is provided with implicit memory management of text in a specialized heap, removing error-prone buffer management, including overrun, and providing a copy-on-write speed boost. For all three utilities, performance is argued to be on-par or surpass those in other comparable languages. With the array, this case is made by showing complete erasure down to a naked C array, modulo runtime bound checks, which are removable more often than with Java-style length management. With the linked list and string, empirical measures are compared with C and C++ comparable libraries. These collections offer programmers workable alternatives to hand-rolling specialized libraries, which is a huge safety benefit, eliminating many system vulnerabilities. The results establish C∀’s position as a safety-forward programming alternative. | |
| dc.identifier.uri | https://hdl.handle.net/10012/24524 | |
| dc.language.iso | en | |
| dc.pending | false | |
| dc.publisher | University of Waterloo | en |
| dc.relation.uri | https://github.com/cforall/cforall | |
| dc.subject | C∀ | |
| dc.subject | C | |
| dc.subject | collections | |
| dc.subject | data structures | |
| dc.subject | safe programming | |
| dc.subject | memory safety | |
| dc.subject | programming languages | |
| dc.subject | standard library | |
| dc.subject | compiler | |
| dc.subject | array | |
| dc.subject | linked list | |
| dc.subject | string | |
| dc.subject | pointer | |
| dc.subject | type system | |
| dc.subject | array length | |
| dc.subject | buffer overrun | |
| dc.subject | bound check | |
| dc.subject | intrusive list | |
| dc.subject | text buffer | |
| dc.subject | heap | |
| dc.subject | memory management | |
| dc.subject | systems programming | |
| dc.title | C∀ Collection Library | |
| dc.type | Master Thesis | |
| uws-etd.degree | Master of Mathematics | |
| uws-etd.degree.department | David R. Cheriton School of Computer Science | |
| uws-etd.degree.discipline | Computer Science | |
| uws-etd.degree.grantor | University of Waterloo | en |
| uws-etd.embargo.terms | 0 | |
| uws.contributor.advisor | Buhr, Peter | |
| uws.contributor.affiliation1 | Faculty of Mathematics | |
| uws.peerReviewStatus | Unreviewed | en |
| uws.published.city | Waterloo | en |
| uws.published.country | Canada | en |
| uws.published.province | Ontario | en |
| uws.scholarLevel | Graduate | en |
| uws.typeOfResource | Text | en |