c-template
|
golang like error handling More...
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdatomic.h>
Go to the source code of this file.
Data Structures | |
struct | cg_error |
Functions | |
cg_error * | new_cg_error (char *message) |
returns a cg_error struct containing message More... | |
char * | cg_error_string (char *message) |
creates a new variable and moves memory of message into that variable returning it this appears to be needed as if we dont do this realloc will complain about an invalid pointer More... | |
int | wrap_cg_error (cg_error *error, char *message) |
appends message to the end of error->message uses realloc to maximize memory efficiency More... | |
void | free_cg_error (cg_error *error) |
frees up resources associated with error More... | |
golang like error handling
provides a C equivlent of golang function returns it enables returning two values from function call, one being an error (if any) and one being data if any
Definition in file errors.h.
char* cg_error_string | ( | char * | message | ) |
void free_cg_error | ( | cg_error * | error | ) |
cg_error* new_cg_error | ( | char * | message | ) |