Re: Compiler Bug? (Relating to Pointer to Member)
- From: "Doug Harrison [MVP]" <dsh@xxxxxxxx>
- Date: Mon, 05 Dec 2005 23:56:10 -0600
On Mon, 5 Dec 2005 21:31:19 -0700, "Jonathan Wood" <jwood@xxxxxxxxxxxxxxxx>
wrote:
>I'm looking at what appears to be a compiler bug. I'm not at liberty to post
>full classes, etc. but will post the relevant pieces.
>
>Project A is a library (LIB). In that project, I define a pointer to member
>type like this:
>
>class CFileWin;
>class CFileIterator;
>typedef void (CFileWin::*LPITERATEFILEFN)(CFileIterator *);
Look at the /vmg options. And then you should probably forget about them,
because you shouldn't require library users to play around with that
option. To see the difference the presence of the class definition can
make, try this program:
#include <stdio.h>
#if 1
class CFileWin;
#else
class CFileWin
{
};
#endif
class CFileIterator;
typedef void (CFileWin::*LPITERATEFILEFN)(CFileIterator *);
int main()
{
printf("%d\n", (int) sizeof(LPITERATEFILEFN));
}
With CFileWin incomplete, the PTM size is 16. With it completed, the size
is 4. The best solution is to define a class before declaring pointers to
its members.
--
Doug Harrison
Visual C++ MVP
.
- Follow-Ups:
- Re: Compiler Bug? (Relating to Pointer to Member)
- From: Jonathan Wood
- Re: Compiler Bug? (Relating to Pointer to Member)
- References:
- Compiler Bug? (Relating to Pointer to Member)
- From: Jonathan Wood
- Compiler Bug? (Relating to Pointer to Member)
- Prev by Date: Re: Modeless Dialog - Handling dialog refreshing while processing
- Next by Date: Re: eclipse plugin
- Previous by thread: Compiler Bug? (Relating to Pointer to Member)
- Next by thread: Re: Compiler Bug? (Relating to Pointer to Member)
- Index(es):