Shop OBEX P1 Docs P2 Docs Learn Events
Removal of unused code? — Parallax Forums

Removal of unused code?

Which p2 compilers remove unused methods, data etc. when compiling source code?

Comments

  • JonnyMacJonnyMac Posts: 9,631

    Spin Tools removes unused methods -- if you enable it in the Preferences dialog. I don't know about unused data; that might be very difficult for the compiler to determine given all the mechanisms that can be used to access data.

  • That's great Jon, I'm mostly uisng Spin Tools at the moment. It's the removal of methods that really counts. Thanks - I hadn't spotted that preference.

  • RossHRossH Posts: 5,700

    Catalina's Optimizer removes unused code and data. But as JohnyMac says, sometimes it can be difficult to tell if something is used or not (e.g. if an item is not declared or used by any C code, but is declared in one inline PASM function and then used in another). In such cases, you need to explicitly force the item to be included by referencing it from C even though that is not strictly required by the program logic.

    Ross.

Sign In or Register to comment.