2 ms·
All C is unsafe, because it's a property of most language features. E.g. this is unsafe: int main(void) { global_init(); service_loop(); global
by kazinator 2y ago
All C is unsafe, because it's a property of most language features. E.g. this is unsafe:
int main(void)
{
global_init();
service_loop();
global_cleanup();
}
Some of these functions, defined in another translation unit could require parameters, but their declarations be incorrect or missing from this translation unit. So the program will link, but the behavior is undefined.
"Unsafe" means that "no diagnostic is required when a rule is broken". When correctness depends on the programmer, such that the tooling silently accepts incorrectness, that is unsafe.
Almost all C is unsafe, but not all coding situations are equally risky of having a problem.