{"id":18029699,"url":"https://github.com/tekknolagi/dcheck","last_synced_at":"2025-03-27T03:31:10.664Z","repository":{"id":142330718,"uuid":"493989758","full_name":"tekknolagi/dcheck","owner":"tekknolagi","description":"C++ dynamic assertion library","archived":false,"fork":false,"pushed_at":"2022-10-21T18:42:55.000Z","size":18,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"trunk","last_synced_at":"2025-03-23T00:41:40.558Z","etag":null,"topics":["assert","cpp","library"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tekknolagi.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":"2022-05-19T08:43:15.000Z","updated_at":"2024-01-04T06:55:45.000Z","dependencies_parsed_at":"2023-06-03T04:15:26.942Z","dependency_job_id":null,"html_url":"https://github.com/tekknolagi/dcheck","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/tekknolagi%2Fdcheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekknolagi%2Fdcheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekknolagi%2Fdcheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekknolagi%2Fdcheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tekknolagi","download_url":"https://codeload.github.com/tekknolagi/dcheck/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245778518,"owners_count":20670682,"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":["assert","cpp","library"],"created_at":"2024-10-30T09:10:40.297Z","updated_at":"2025-03-27T03:31:10.647Z","avatar_url":"https://github.com/tekknolagi.png","language":"C","readme":"# [dcheck](https://github.com/tekknolagi/dcheck)\n\nThis very small assert library provides `assert`-like macros for checking\nconditions at runtime. It works with C and C++.\n\nImprovements over raw `assert`:\n\n* Semantic checks for indices, bounds, ranges, unimplemented features, and\n  unreachable states\n* Includes `printf`-compatible error message formatting\n* `NDEBUG` and always-on variants\n* Bounds/index checking built-in\n* File/function/line number and symbolized condition code in error message\n* Still checks code for compiler errors if DCHECK is turned off\n\nHere is some sample code:\n\n```c\n#include \"dcheck.h\"\n\nint main() {\n  // ...\n\n  CHECK(true, \"thank goodness\");\n\n  int arr[3];\n  // Array index won't crash\n  CHECK_INDEX(ind, 3);\n\n  // Still can order off the kids menu\n  CHECK_BOUND(age, 5);\n\n  // Month is valid\n  CHECK_RANGE(month, 1, 12);\n\n  if (needs_feature) {\n    UNIMPLEMENTED(\"needs Brian's feature\");\n  }\n\n  if (val == 4) {\n    UNREACHABLE(\"unexpected number %d\", val);\n  }\n\n  // ...\n}\n```\n\nAdd `D` before `CHECK`, `CHECK_INDEX`, `CHECK_BOUND`, and `CHECK_RANGE` if you\nwant the check to go away in `NDEBUG` mode. Like `DCHECK_INDEX` and so forth.\n\nHappy hacking.\n\n## Use in CMake projects\n\n```cmake\ninclude(FetchContent)\nFetchContent_Declare(\n  dcheck\n  GIT_REPOSITORY https://github.com/tekknolagi/dcheck\n  GIT_TAG        trunk\n)\nFetchContent_MakeAvailable(dcheck)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftekknolagi%2Fdcheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftekknolagi%2Fdcheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftekknolagi%2Fdcheck/lists"}