Skip to content
  • 0 Votes
    4 Posts
    5k Views
    Chris KawaC

    The two list types are unrelated so casting pointers to them is still not ok at all. To push the previous analogy - for compiler it's like casting int* to string*. You can of course use reinterpret_cast and the compiler will be happy to trust you, but that is in no way correct and will obviously explode in your face at runtime.

  • 0 Votes
    8 Posts
    6k Views
    JKSHJ

    @Bart_Vandewoestyne said:

    Could my educated guess be correct?

    Your guess sounds reasonable to me.

    Does anybody have any idea why the original author of this code decided to make a difference between linux and non-linux? If I remove the ifdef and simply use close() in all situations, things seem to work, although it seems that in this case the ClientSslSocket destructor is no longer called (and I'm not sure if this is a good thing...).

    Nope, sorry. Are there any comments in the code, or in the commit history? Could you ask the author directly?

    What would be the clean solution here? How should FooBar's destructor look like?

    It's hard to say without knowing how the rest of the program is designed. Maybe you can manually disconnect the socket before deleting it?