Hacker News new | ask | show | jobs
by P_I_Staker 2418 days ago
I agree to some extent (I'd also add that undisciplined and apathetic programmers are an even bigger problem).

I have to disagree about implicit functions not being a part of C anymore. I've yet to see one generate an error; this is optional, and frequently not used. I'm including brand new, state of the art compilers, even (default) gcc. Of course, not even emitting a warning is bananas.

I confirmed this, with the following snippet:

// start fail.c

int fail = 0;

// end fail.c

int main(void)

{

   fail();
   return 0;
}

gcc --std=c99 -g main.c fail.c -o main.exe && gdb main.exe -ex run

# Cmd line junk, however a warning was emitted for implicit function "fail"

Program received signal SIGSEGV, Segmentation fault.

0x00407020 in fail ()

1 comments

>I have to disagree about implicit functions not being a part of C anymore. I've yet to see one generate an error;

This is not really a debatable matter. There's an international standard for what is, and what is not a part of the C language.

Errors as you seem to understand them are optional for everything else except for the #error preprocessor directive. For all the other invalid C programs, only a diagnostic (like the warning you got) is required, and a conforming implementation is free to complete translating the invalid translation unit. I don't see why that would be an issue, as it's very easy to switch those warnings into translation errors if wanted.