4 ms·
I disagree that you shouldn't do it. The way you do it is to add a comment // This %thing% was generated from %template% using data from %data%. If your langu
by ndh2 9y ago
I disagree that you shouldn't do it. The way you do it is to add a comment
// This %thing% was generated from %template% using data from %data%.
If your language is too restrictive to add sensible tools, you should write the tools yourself. As with any code, write it in a way such that other people will be able to understand it.
There is no magic, it's just code. I wish people would stop using that word.
- msangi 9y agoThe original comment says "they just weren't anywhere in the code that humans could see." Where would you and the comment in a situation like that one? I don't have anything against generated code but it should be visible and, as you said, it should be crystal clear where it come from
- ndh2 9y agoI think in this instance it's also a matter of tools. Visual Studio/Visual Assist would have been able to find the class definition, and that's where the comment would go. For cscope it's a matter of configuration, which should be auto-generated by the build tool. If the class is being used, then the definition has got to be somewhere, hopefully in a header. It's simply a file that is included somewhere. And it will be human readable. There is no magic.
- mikelevins 9y agoThe class definitions were not in any file. That was the entire point. They didn't exist at all except as transient build artifacts.