All Questions
Tagged with error-handling c
616
questions
0
votes
2
answers
66
views
Error communication between functions in C using linked list
There are functions in different files in my C program between which I want to communicate errors. For example:
MEMOERY_ALLOCATION_FAILED, FILE_OPENING_FAILED or NAME_NOT_VALID.
I thought of creating ...
1
vote
1
answer
59
views
How Can I use TEST_PROTECT in Unity C Test Framework, to achieve a behaviour of the example
I've created the following code snippet to reproduce a problem with my error handling mechanism in Unity C Test Framework.
By using TEST_PROTECT() as it is described in Unity C Test framework ...
1
vote
0
answers
40
views
is it possible to handle webgl errors gracefully?
In Webgl is there a way of "catching" errors in the same way as you might do this in a CPU focussed language?
I'm specifically having a problem where my whole browser is crashing our before ...
0
votes
1
answer
71
views
how handle Zig error sets from C using Zig ABI
I want to call a zig function from c but the fn return type is an error union !void or MyType.Error!u32
how to handle the error?
let's assume we have the following lib.zig
pub fn errorProneFunction(...
0
votes
0
answers
30
views
Why am I getting this computation error of unkown type name 'driver_proc'
Full screen of code and libraries
computation errors
I am encountering a compilation error related to driver_proc struct definition in my project for phase4. The error appears when I try to run make ...
0
votes
1
answer
49
views
Calculation of income tax owed is not working correctly
this program will calculate your tax bracket by the entering your income and your marital status, s for single and m for married.
The program will prompt you to enter income, then marital status. ...
1
vote
2
answers
106
views
Is there any way to recover from a printf()/puts() error?
Whilst interpreting and transpiling Brainfuck, I have this series of calls to printf()/puts():
while (ip < ops->count) {
Op op = ops->items[ip];
switch (op.kind) {
...
0
votes
1
answer
67
views
C user-defined error codes instead of enum or defines
One of the standard approaches in C error handling code is that functions return an error code, which must then be handled by the calling code. I often see libraries with a header file containing a ...
1
vote
2
answers
87
views
Make a custom error in C if header file not found
Is there a way to make C code show a custom error if a header file is not found? I feel this would particuraly useful for trying to compile windows code on linux. For example, instead of "Windows....
2
votes
4
answers
120
views
In C, can `enum` be made to count backward?
I would like to create an enumerated list of negative values for error handling so <0 is an error and >=0 is valid for some function:
int f() {
if (someerror())
return ERR_TYPE_2;
else
...
1
vote
1
answer
77
views
Trouble Interfacing Errors Between C and Lua: Seeking Solutions
Hello Stack Exchange Community,
I am facing a challenging issue with a project that involves interfacing between C and Lua code. The project utilizes Lua for scripting and C for certain critical ...
1
vote
2
answers
85
views
C: Problem with reading in a matrix via User Input
I am trying to write a simple C program, where the user can enter a 3 x 2 matrix. The input is expected to be row-wise in the form (the length of the input row is assumed to be fitting, i.e. 2)
3,4
...
0
votes
0
answers
43
views
how to make dpdk processes tolerable to segmantation fault?
In a normal c program, I saw that the segmentation fault in 1 loosely coupled thread doesn't necessarily affect other threads or the main program. There, I can check all the threads by process ID of ...
1
vote
0
answers
46
views
Undefined Reference to 'omp_get_wtime'
I am trying to run a C program on Clion using OpenMP. All my earlier programs ran but for some reason this one isnt. I have included the following in my main.c file:
#include "qdbmp.h"
#...
1
vote
2
answers
86
views
C error: incompatible pointer types issue using typedef for int array
I am trying to implement a simple function that assigns the values of one array to another, but I keep getting an error
program.c:90:14: error: incompatible pointer types passing 'longint_t' (aka 'int ...