I thought that private methods, which are not used inside its class are removed by the compiler/linker and would not be part of the final binary.

I have created an example class, with a private method which is implemented but not used.

class XXX
{
  public:
  XXX();

  private:
  void MyUnusedMethod();
};

And in the implementation file:

void XXX::MyUnusedMethod()
{
  const char* hugo = "ABCCHARLYABC";
  printf( hugo );
}

After compilation the string still exist in the final binary. Why? And how can I prevent this?

Best regards, Charly

Edit
Report