March 24, 2005 Compile an empty source file | ||||
---|---|---|---|---|
| ||||
v0.119 windows I quite by accident found you can compile a completely empty source file and get both an obj and an exe (which does nothing but runs without error). I think the compiler should error if no code has been generated. Russell |
April 05, 2005 Re: Compile an empty source file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russell Wilkins | Russell Wilkins wrote: > v0.119 windows > > I quite by accident found you can compile a completely empty source file and get both an obj and an exe (which does nothing but runs without error). Congratulations, you've written the shortest ever D quine! > I think the compiler should error if no code has been generated. Not sure about this. Do you mean the compiler or the linker? I can see a few legit reasons for a module having no code generated: - it's a module entirely of import statements, function prototypes, struct definitions, type aliases, symbolic constants, whatever else.... - it's a module that's only needed for certain platforms/editions/whatever, and so all the code may be versioned out (if that follows). OTOH, the linker ought to error, since there is no main function. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit. |
Copyright © 1999-2021 by the D Language Foundation