Is there a way to fix a failed static allocation, or is the program just failing with segmentation or a bus crash on startup?
Post was inspired by the way the C99 resolves crazy things like char text[n];
char text[n];
EDIT: Thanks. Now I understand that the bold is not a static value. So just check if something like char text[1234];fails, the possible recovery strategies will be the same?
char text[1234];
char text[n]pushes an array of variable sizes onto the stack. It just includes increasing the stack pointer to n.
char text[n]
n
, , , , .
, (), , . , n , , , , .
, , .
man 7 signal
, man alloca , "" , SIGSEGV, , , , text [] , , , , [] .
man alloca
Linux, .
malloc . .
[EDIT]
, ( ) ( , ). , , , . , .
This is more a stack distribution than a static one. Failure mode - stack overflow. The most rational policy is to consider it terminal.
Create your code so that it does not overflow the stack, and does not try to make it resistant to stack overflows.