Newsgroups: microsoft.public.vc.stl
From: "Doug Harrison [MVP]" <d...@mvps.org>
Date: Sun, 29 May 2005 01:44:50 -0500
Local: Sun, May 29 2005 2:44 am
Subject: Re: vc71 compiler seems to be very buggy
On 28 May 2005 22:11:39 -0700, exlo...@ml1.net wrote:
> Very well. You asked me to shatter your confidence in the vc71 There's a bug in <winsock2.h> such that it changes the packing from the > compiler/runtime right? You'll now get what you asked for. > I stripped down my sources and obfuscated them just for you. > The bug you are about to observe it TRULY bizarre and freakish! > Here is how to reproduce - extract 4 files: a.cpp, b.cpp, c.h and > Bizarre thing #1 if you remove <winsock2.h> from a.cpp, rebuild, then > Bizarre thing #2 if you restore <winsock2.h> in a.cpp the way it was > Also it's important to stress that concurrency is NOT an issue with > Also, comments about the logic of the program are useless because I've > My computer runs XP, latest service pack. > ----------- build.bat begins ---------------------- > ----------- a.cpp begins -------------------------- > #include "c.h" > void funct1(void *arg) > printf("exiting funct1\n"); > ------------b.cpp begins --------------------- > #include <stdio.h> > #include "c.h" > map<string,dainty> *ptr; > static unsigned __stdcall wrapper_str(void *arg) > int main() > unsigned thrid; > ----------- c.h begins ----------------------- > #include <string> > class myobject { > void delete_myobject() { > public: > refcnt = (volatile unsigned long *) malloc(sizeof *refcnt); > *refcnt = 0; > myobject(const myobject &arg) : opaque(arg.opaque), > ~myobject() { delete_myobject(); } > myobject &operator=(myobject const& arg) { > if(refcnt != arg.refcnt) { > out: return *this; > class hahaha { > class my_data { > class dainty { > #endif /* _c_h_ */ default 8 to 4 when WIN32 isn't #defined. You're #including c.h in two different ways; in a.cpp, it follows <winsock2.h>, while b.cpp doesn't #include <winsock2.h>. I expect this is causing various classes to have different layouts in these files. You can see the underlying problem if you add the following line to the top of c.h and following all its #include directives: #pragma pack(show) Then when I compile using your command line, I get: C>cl -I. -nologo -MDd -EHsc -W3 -DWINVER=0x400 a.cpp b.cpp I think that in general, if you're going to use the Windows SDK, you should -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||