I have a file that I would like to be able to either execute with a C interpreter, or compile with GCC. As you know, Unix uses "#!/path/to/interpreter" to invoke scripts. Consider the following program:
#!/usr/bin/c-interpreter int main() { printf("Hello World\n"); } It would be nice if this could be compiled by GCC, simple by ignoring the first line of the file. The current error message is: hello.c:1:2: error: invalid preprocessing directive #! One easy fix would be to define the preprocessing directive #! as a legal directive, which swallows the rest of the line. This would work with C, C++, and ObjC, but not the other languages. Another possibility that would work universally is to make #! as the first two characters of an input file a "special case" comment specifier in all front-ends. It doesn't need to be recognized anywhere except as the first two bytes of a file. Please consider this small but useful feature as it will help me with writing portable code that can be interpreted as well as compiled. -- Summary: Please ignore #! on the first line of a file Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: preprocessor AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: drwowe at yahoo dot com GCC build triplet: All GCC host triplet: All GCC target triplet: All http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41492