473,394 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Compiler error

....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;
}
Nov 16 '05 #1
3 1029
>From: "Jens Thiel" <je**@thiel.de>
Subject: Compiler error
Date: Fri, 31 Oct 2003 11:52:34 +0100
...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;
}

"Jens Thiel" <je**@thiel.de> wrote in message
news:OI**************@TK2MSFTNGP11.phx.gbl... ...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;
}


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:

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

Nov 16 '05 #2
> >...or what am I doing wrong with the the i++ increment operator?

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


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:


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.
Nov 16 '05 #3
Jens Thiel wrote:
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
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...


-cd
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: paul calvert | last post by:
I hope somewhere here has encountered and solved a similar problem in the past. 1) on a new Win2000 PC: installed Visual C++ 6.0 download & install single file Service Pack 5.0 2) try to...
2
by: Mike Fisher | last post by:
I'm seeing an error when I try to run/debug a web service. Although it doesn't happen every time, it does occur more than half of the times I hit F5. It appears to be returned by the the JIT...
10
by: Bjorn | last post by:
I'm using interfaces in C++ by declaring classes with only pure virtual methods. If then someone wants to implement the interface they needs to inherit from the class. If the implementing class...
2
by: Mary | last post by:
Hello, I am having a problem with the cl compiler. I have written a C class (RegConnect.c) which uses Win32 API functions such as RegOpenKey, RegCloseKey etc. Initially when I was trying to...
0
by: rollasoc | last post by:
Hi, I seem to be getting a compiler error Internal Compiler Error (0xc0000005 at address 535DB439): likely culprit is 'BIND'. An internal error has occurred in the compiler. To work around...
1
by: Ayende Rahien | last post by:
reparing resources... Updating references... Performing main compilation... error CS0583: Internal Compiler Error (0xc0000005 at address 53168B12): likely culprit is 'BIND'. An internal...
3
by: Mark Rockman | last post by:
------ Build started: Project: USDAver2, Configuration: Debug .NET ------ Preparing resources... Updating references... Performing main compilation... error CS0583: Internal Compiler Error...
4
by: David Sworder | last post by:
Consider the following line of code (it's not important what it does): resp.DocItem=Relations.SelectDocItems_BySearchString(req.SearchPhrase); It turns out that this line is in error. The...
6
by: David Lack | last post by:
Hi, I recently installed a 60-day trial of .NET 2003 on my development system. I made tests with previous personal projects (which compiled ok with VC6) and some open source files, and keep...
27
by: Dave | last post by:
I'm having a hard time tying to build gcc 4.3.1 on Solaris using the GNU compilers. I then decided to try to use Sun's compiler. The Sun Studio 12 compiler reports the following code, which is in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.