This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Sun, 2002-09-29 at 04:37, egor duda wrote: > I guess i know why it works for you. Hint: Try gcc 3.x to build > cygwin1.dll. Me and Chris, are using it, obviously, while you're > probably using 2.95, right? Yes, I've been holding off upgrading until gcc 3.x is the default for cygwin, at which time I will migrate the setup sources to 3.x. > class verifyable_object contains no virtual functions, hence no > pointer to VMT in it. This means that compiler assumes that magic > member is placed at offset 0 from the beginning of class. Which is valid for verifyable_object but will *kill* any derived classes. Yep. coding bug on my behalf. Can you or Chris try the test run after changing the verifyable_object destructor to be virtual (thread.h, line 163). > class > pthread is a subclass of class verifyable_object, but it _does_ > have VMT to accommodate virtual method 'create'. As far as i can > understand from assembly, pointer to VMT is placed at the beginning of > object instance, at offset 0, while members are placed after it, so > 'magic' has offset 4. Thank you for digging, I imagine this took some time - and you've saved me a lot of head scratching. > Now, in verifyable_object_isvalid you're casing pointer to variable of > subclass to pointer to base class. Ain't it case of 'never do like > this'? I suppose to safely perform cast from subclass to base class > one should always use dynamic_cast(). It's a case of this is always ways ok to do - upcasting is FINE.. (it happens every time you call a virtual function in fact). It's never ok to case a base class to a subclass (known as downcasting) unless you use a static_cast or a dynamic_cast. http://www.cs.rpi.edu/~wiseb/xrds/ovp3-1.html What *may* be a regression in 3.2 is the apparent bug caused by the introduction of a VMT in a derived class. However, as we already have a destructor for verifyable_object, and in this instance it should be virtual, we get to sidestep the bullet - for now. Rob -- --- GPG key available at: http://users.bigpond.net.au/robertc/keys.txt. ---
Attachment:
signature.asc
Description: This is a digitally signed message part
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |