{"id":21309999,"url":"https://github.com/tadd/libscary","last_synced_at":"2025-07-18T08:36:44.839Z","repository":{"id":259906063,"uuid":"860419442","full_name":"tadd/libscary","owner":"tadd","description":"A (scary) scalable array library in C","archived":false,"fork":false,"pushed_at":"2025-05-24T15:06:13.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-24T16:28:53.244Z","etag":null,"topics":["array","c-library","scary"],"latest_commit_sha":null,"homepage":"https://github.com/tadd/libscary","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tadd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-20T12:00:15.000Z","updated_at":"2025-05-24T15:06:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"cb9a4b40-a412-4a1a-bb3c-0b4dea098393","html_url":"https://github.com/tadd/libscary","commit_stats":null,"previous_names":["tadd/libscary"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tadd/libscary","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tadd%2Flibscary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tadd%2Flibscary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tadd%2Flibscary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tadd%2Flibscary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tadd","download_url":"https://codeload.github.com/tadd/libscary/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tadd%2Flibscary/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265728956,"owners_count":23818733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["array","c-library","scary"],"created_at":"2024-11-21T17:11:54.814Z","updated_at":"2025-07-18T08:36:44.815Z","avatar_url":"https://github.com/tadd.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"libscary: A (scary) scalable array library in C\n===============================================\n\nThis is one of those rotten dynamic array libraries, but wait, just take a look.\n\n```c\nint *a = scary_new(sizeof(int));\n```\nLook at this LHS; it looks like an ordinary C array, but\n\n```c\nprintf(\"length: %zu\\n\", scary_length(a)); //=\u003e 0\n```\nthey know their length by themselves 😱.\n\n```c\nscary_push(\u0026a, -1);\nscary_push(\u0026a, 42);\nprintf(\"new length: %zu\\n\", scary_length(a)); //=\u003e 2\n```\nYou can push elements with automatic memory extension,\nas much as you want.\n\nMoreover, the `scary_push` function is _generic_ 😱. If you put this code,\n\n```c\nscary_push(\u0026a, 0UL); // Pushing `unsigned long` into an array of `int`!\n```\n\nit will produce a warning by default with modern compilers like GCC 12.\n\n\u003cpre\u003e\u003ccode\u003e\u003cb\u003ewarning:\u003c/b\u003e passing argument 1 of 'scary_push_uint64' from incompatible pointer type [\u003cb\u003e-Wincompatible-pointer-types\u003c/b\u003e]\n    scary_push(\u003cb\u003e\u0026a\u003c/b\u003e, 0UL);\n               \u003cb\u003e^~\u003c/b\u003e\n               \u003cb\u003e|\u003c/b\u003e\n               \u003cb\u003eint **\u003c/b\u003e\n\u003c/code\u003e\u003c/pre\u003e\n\nYou can of course opt-in an option `-Werror` to prevent such typing mistakes.\n\nAnd you'll see **magic** here:\n\n```c\nint i = a[1];\n```\nYou can read/write them as ordinary C arrays with **zero**-overhead 😱😱.\n\n```c\nprintf(\"content: %d\\n\", i);\n```\nThen it prints `42`. Happy ending. 🤔🤔\n\n## Usage\n\n1. `make` and get `libscary.so`.\n2. Write your code with `#include \u003cscary.h\u003e`.\n3. Compile with `-lscary` and proper `-I`/`-L`.\n4. Enjoy your looseness.\n\n## Development\n\nWe use [Criterion](https://github.com/Snaipe/Criterion) for tests so\nyou'll need to install that before `make test`.\n\nDear Debian/Ubuntu users: You can install its package via\n\u003ccode\u003eapt install [libcriterion-dev](https://packages.debian.org/stable/libcriterion-dev)\u003c/code\u003e.\n\n## License\n\n[CC0](./CC0.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftadd%2Flibscary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftadd%2Flibscary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftadd%2Flibscary/lists"}