256_ 7 hours ago

> While strictly speaking, smr.c is not a valid C program, it is not an invalid C program either! Some C compilers will compile an empty file into a program that does nothing.

How do they define "invalid"? Section 6.7 (page 81) of the C89 standard defines a translation unit as a series of one or more external declarations.

I assumed that a main() function was a requirement, but section 5.1.2.2 (page 6) does not require this (which seems obvious in retrospect; that's how object files are compiled).

I think the shortest valid C program would be "f();". gcc accepts it. In fact, gcc agrees with my conclusion above, and says, for a blank file: "ISO C forbids an empty translation unit".

What do other compilers say?