Re: VC++ 7.1 bug?
From: Wes Spikes (MornThdr_at_NOSPAMverizon.net)
Date: 08/16/04
- Next message: Wes Spikes: "New C++6 Programmer looking for books"
- Previous message: Doug Harrison [MVP]: "Re: VC++ 7.1 bug?"
- In reply to: Linus Jegher: "VC++ 7.1 bug?"
- Next in thread: Carl Daniel [VC++ MVP]: "Re: VC++ 7.1 bug?"
- Reply: Carl Daniel [VC++ MVP]: "Re: VC++ 7.1 bug?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 16 Aug 2004 21:15:13 GMT
First things first: I have VS6Pro. I do not plan on upgrading anytime soon
to .NET (I don't have the money.)
Now, I am very interested in learning Visual C++ 6. Are there any good books
like "Java Examples in a Nutshell" but for C++? (I learn better from source
code then commentary and instruction like most books give!)
-Wes
"Linus Jegher" <ljegher@hamilton.ch> wrote in message
news:eO$N3l8gEHA.3988@tk2msftngp13.phx.gbl...
> Hello!
>
> There is a strange behavior in VC++7.1 (Microsoft Development Environment
> 2003 Version 7.1.3088; Microsoft Visual C++ .NET) which was not in
VC++7.0:
> The if (0 == symval.u.resource.type)-statement in the code below seems to
be
> left out. The following block is always entered. This happens in the debug
> build and with a SYMVAL::U union that is larger than 16 bytes. When i
> execute the code below i get the following output:
>
> sizeof( SYMVAL::U)=24
> if (0 == symval.u.resource.type)...
> symval.u.resource.type == 1
>
> // Code Begin
> #include <iostream>
>
> // #define SMALL_UNION
>
> struct RESOURCE {
> int type;
> double f1;
>
> #ifndef SMALL_UNION
> double f2;
> #endif
> };
>
> struct SYMVAL {
> int stype;
> union U {
> int nVal;
> RESOURCE resource;
> } u;
> };
>
> int main(int argc, char* argv[])
> {
> std::cout << "sizeof( SYMVAL::U)=" << sizeof( SYMVAL::U) << "\n";
>
> SYMVAL sval;
> sval.u.resource.type = 1;
>
> SYMVAL symval = {0};
> symval = sval;
> if (0 == symval.u.resource.type)
> {
> std::cout << "if (0 == symval.u.resource.type)...\n";
> std::cout << " symval.u.resource.type == " <<
symval.u.resource.type
> << "\n";
> }
> return 0;
> }
> // Code End
>
> What's going on?
> Thanks
>
> Linus
> --
>
> Linus Jegher - ljegher@hamilton.ch - www.hamiltoncomp.com
>
>
- Next message: Wes Spikes: "New C++6 Programmer looking for books"
- Previous message: Doug Harrison [MVP]: "Re: VC++ 7.1 bug?"
- In reply to: Linus Jegher: "VC++ 7.1 bug?"
- Next in thread: Carl Daniel [VC++ MVP]: "Re: VC++ 7.1 bug?"
- Reply: Carl Daniel [VC++ MVP]: "Re: VC++ 7.1 bug?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|