3 ms·
How do you refactor complex C code with myriad of macros? I think we should avoid writing code that having to seriously change its structure later. If we want t
by tuhdo 12y ago
How do you refactor complex C code with myriad of macros? I think we should avoid writing code that having to seriously change its structure later. If we want to refactor, it should be minimal and manageable.
And if you mean seriously refactoring as in this article from Qt Creator: http://qt-project.org/doc/qtcreator-2.6/creator-editor-refactoring.html#refactoring-c-code http://qt-project.org/doc/qtcreator-2.6/creator-editor-refac... that includes reformatting code, generating getter/setter or automatically detect and fix mistake for you, then no. I have never write such code in the first place that having to back later and I believe we should not fall into the use cases listed in that article.
My only use case for refactoring is to rename variable/function names.
- emsy 12y agoRefactorings are used to adapt your code to newly acquired knowledge and/or changed requirements. That are things that CAN'T BE PLANNED because you simply don't know them yet. Therefore you can't plan how minimal you'll have to refactor. Let's take the "rename function" refactoring. You claimed sed was sufficient. What about functions with the same name in different namespaces or different visibilities? The same goes for move parameter. Sometimes you want to move a parameter so the order adheres to a guideline that you've accidentially forgotten or that newly emerged. Again: What about ambiguos function names? Refactorings such as pull method up (e.g. to create an interface)/ push method down are probably not even possible with sed. Those are small and manageable refactorings. But even a small refactoring such as rename function can mess up your code if not done correctly.
- deleted 12y ago[deleted]