#### Archived

This topic is now archived and is closed to further replies.

# Equivalent code

This topic is 5557 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Is
int startrow=DrawableArea1.top-MapArea.top;
int endrow=DrawableArea1.bottom-MapArea.top;

int yn=endrow-startrow;

int * rowlookup=new int[endrow-startrow];
int * rowl=rowlookup-startrow;
for(y=startrow;y<endrow;y++)
{
int y2=int(y1);
if(y2<miny) y2=miny;
if(y2>maxy) y2=maxy;
rowl[y]=y2*rowstep+datarow1;
y1+=yd;
}
Equivalent to
int startrow=DrawableArea1.Top-MapArea.Top;
int endrow=DrawableArea1.Bottom-MapArea.Top;

int yn=endrow-startrow;

int[] rowlookup = new int[endrow-startrow];
for(y=startrow;y<endrow;y++)
{
int y2=(int)y1;
if(y2<miny) y2=miny;
if(y2>maxy) y2=maxy;
rowlookup[y]=y2*rowstep+datarow1
y1+=yd;
}

##### Share on other sites
DrawableArea1.top
DrawableArea1.Top

No. C++ is case sensitive. top and Top could mean totally different things.

int * rowl=rowlookup-startrow;

That's the other difference I could spot. And surely that row has some implications, don't you think? (as rowl is used later instead of rowlookup)

[edited by - civguy on September 23, 2003 7:03:51 AM]

##### Share on other sites
Sorry i should have made it more clear, the first code is c++ the second C#

##### Share on other sites
You calculate this 'yn' but you don't use it. In C# version, the loop should be

for(y=0;y<yn;y++)

Then they should be equal.

[edited by - civguy on September 23, 2003 8:03:52 AM]

1. 1
2. 2
3. 3
Rutin
23
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 11
• ### Forum Statistics

• Total Topics
633653
• Total Posts
3013157
×