Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / October 2003

Tip: Looking for answers? Try searching our database.

Compiler error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jens Thiel - 31 Oct 2003 11:52 GMT
...or what am I doing wrong with the the i++ increment operator?

/*
   compile with /clr

   Output (compiled with VS.NET 2003, Framework 1.1) is:

   r=0, i=0
   r=1, i=0
   r=2, i=0
*/

#include "stdafx.h"
#using <mscorlib.dll>

using namespace System;

int _tmain()
{
   Int32 i1[] = { 1, 2, 3, 4, 5 ,6 };
   Int32 i2[,] = new Int32[3, 2];

   for( int i=0, r=0; r<3; r++ )
   {
       i2[r,0] = i1[i++];
       i2[r,1] = i1[i++];

       Console::WriteLine( String::Format(
           S"r={0}, i={1}", r.ToString(), i.ToString() ) );
   }

   Console::ReadLine();

   return 0;
}
Jonathan Caves [MSFT] - 31 Oct 2003 17:09 GMT
>From: "Jens Thiel" <jens@thiel.de>
>Subject: Compiler error
[quoted text clipped - 34 lines]
>    return 0;
>}

> ...or what am I doing wrong with the the i++ increment operator?
>
[quoted text clipped - 31 lines]
>     return 0;
> }

Jens: You're are doing nothing wrong: this is a compiler bug. The
work-around is to move the
increment operator out of the array access: for example:

i2[r,0] = i1[i];
i++;
i2[r,1] = i1[i];
i++;

I will ensure that this bug is fixed in the next release of the product:

Signature

Jonathan Caves, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights.

Jens Thiel - 31 Oct 2003 18:50 GMT
> >...or what am I doing wrong with the the i++ increment operator?
> >
[quoted text clipped - 11 lines]
>
> I will ensure that this bug is fixed in the next release of the product:

Jonathan, the workaround was clear... Since I have plenty of existing code
which could be affected, I would be interested in the full coverage of this
bug. Do you have more information?

Is this fixed in the preview of Whidbey shipped through MSDN subscriptions?
Is it possible to get an updated version or hotfix of the 7.1 compiler
somewhere?

I have also hit other bugs that I found more or less documented in this
newsgroup (eg. virtual bool). There are also some strange and
non-deterministic problems with managed C++, IJW interop and JIT compilation
(no problem with NGENed images) which I am not able to reproduce out of the
project. And I have problems consuming attributes from managed C++ that were
written in managed C++. Oh well...

Jens.
Carl Daniel [VC++ MVP] - 31 Oct 2003 21:50 GMT
> Jonathan, the workaround was clear... Since I have plenty of existing
> code which could be affected, I would be interested in the full
> coverage of this bug. Do you have more information?

I can't comment on the scope of this bug - hopefully Jonathan or another VC
team  member can provide more information on that.

> Is this fixed in the preview of Whidbey shipped through MSDN
> subscriptions? Is it possible to get an updated version or hotfix of
> the 7.1 compiler somewhere?

This bug does appear to be fixed in the alpha build of Whidbey.  Hotfixes
are available by calling Microsoft product support - if there's a hotfix,
they'll know about it.

> I have also hit other bugs that I found more or less documented in
> this newsgroup (eg. virtual bool). There are also some strange and
[quoted text clipped - 3 lines]
> attributes from managed C++ that were written in managed C++. Oh
> well...

-cd

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.