2

I have a small project in C++ VS 2010, which uses a couple of static link libraries(.lib files).

This options are turned on: OPT:REF, OPT:ICF, /GL, GR-

When I add unused method to a class, which uses some code from static libraries, compiler generated bigger code(i.e. includes this method in final executable)

Why? What am I doing wrong?

let4be
  • 1,048
  • 11
  • 30
  • Is it virtual, perchance? Just curious. (not going down the road of why you're adding unused code in the first place, as I'm sure you have your twisted reasons). – WhozCraig Apr 21 '13 at 06:55
  • Well, this code resides in a shared class file, which uses by multiple projects, and thats why I need dead code elimination. Method isn't virtual, just normal public method. – let4be Apr 21 '13 at 06:59
  • Any particular reason you're being anal about the .exe (or .dll) size? How much of a size difference are we talking about? A few K? A 100K? 1MB or more? Just curious... – paulsm4 Apr 21 '13 at 07:01
  • 1
    Difference is about 200 kb... This is just curiosity, cannot understand why compiler is doing this :\ – let4be Apr 21 '13 at 07:05
  • Other options may conflict, /Gy could be turned off (it is off by default for member functions defined out of class declaration), class could be exported -- too many things to consider. – Mike Tyukanov Apr 21 '13 at 10:50
  • /Gy is turned on, and class isn't exported. Just a cpp/h file that included in several projects – let4be Apr 21 '13 at 11:04

0 Answers0