{"id":16984690,"url":"https://github.com/not-nik/libcx","last_synced_at":"2025-03-22T01:19:35.576Z","repository":{"id":104028919,"uuid":"299025774","full_name":"Not-Nik/libcx","owner":"Not-Nik","description":"cx is another attempt to bring exceptions to C","archived":false,"fork":false,"pushed_at":"2020-09-27T12:22:25.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T05:08:57.107Z","etag":null,"topics":["c","exception-handling","exceptions","signal-handler"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Not-Nik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2020-09-27T12:19:58.000Z","updated_at":"2022-09-03T20:13:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"7537eaed-6b40-4711-8d91-599bdc9b783c","html_url":"https://github.com/Not-Nik/libcx","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Not-Nik%2Flibcx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Not-Nik%2Flibcx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Not-Nik%2Flibcx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Not-Nik%2Flibcx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Not-Nik","download_url":"https://codeload.github.com/Not-Nik/libcx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244890532,"owners_count":20527117,"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":["c","exception-handling","exceptions","signal-handler"],"created_at":"2024-10-14T02:33:34.990Z","updated_at":"2025-03-22T01:19:35.559Z","avatar_url":"https://github.com/Not-Nik.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\nThis repo contains two similar versions of the same library.\ncx is another attempt to bring exceptions to C.\n\n# Comparing\n|aspect|cx | cx2 |\n|------|---|-----|\n|Required standard library functions|`puts`, `printf`|`puts`, `printf`, `setjmp`, `longjmp`|\n|Special return type|Yes|No|\n|Thread safe|Somewhat|Definitely no|\n|Custom errors|Yes|Yes|\n|User defined error handler|Yes|Yes|\n|Trace back after exception|Yes|Yes|\n|Signal handling|No|Yes|\n|TRY/FIN signature|(\\\u003cstruct with .ex and .val\\\u003e) -\u003e value of struct|(\\\u003cany code block\\\u003e) -\u003e no return|\n\n# cx\nLightweight version of cx.\n\n### Minimal example\n```c\n#include \u003ccx.h\u003e\n#include \u003cstdio.h\u003e\n\nvoid exception_handler(int err) {\n    puts(\"Error\");\n}\n\nint_ex error_function() {\n    ERR(int_ex, 0);\n    OK(int_ex, 2) // Not executed\n}\n\nint main() {\n    set_handle(exception_handler);\n    int i = FIN(error_function())\n}\n```\n\n# cx2\nFancy-pants version of cx.\n\n### Minimal example\n```c\n#include \u003ccx2.h\u003e\n#include \u003cstdio.h\u003e\n\nvoid exception_handler(int err) {\n    puts(\"Error\");\n}\n\nint error_function() {\n    ERR(0);\n    return 2; // Not executed\n}\n\nint main() {\n    set_handle(exception_handler);\n    FIN(int i = error_function())\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnot-nik%2Flibcx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnot-nik%2Flibcx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnot-nik%2Flibcx/lists"}