 |
 |
| View previous topic :: View next topic |
| Author |
Message |
jeremiah
Joined: 20 Jul 2010 Posts: 1411
|
|
Posted: Sun Mar 06, 2016 8:30 am |
|
|
It's also worth saying that if you want certain features tweaked or added or fixed, then make a small program they can compile and run, and email them at the support email with it and the things you would like to see changed. Be cordial about it and very thorough on exactly what you wishing they would add (it really helps if the example file you send has some comments that reflect those features...like where the breakpoint breaks and where you wish it would break, etc.).
They don't always check this forum since it is only a user forum. You might get lucky and they see this thread, but to be sure, send some info to their support team directly. |
|
 |
russk2txb
Joined: 30 Mar 2008 Posts: 109 Location: New Jersey
|
|
Posted: Tue Mar 08, 2016 9:35 am |
|
|
Ok, here is another situation. Consider an array | Code: | | long ay [][2] = {{ 1,25 }, { 2,234 }, { 3, 301 }}; | Now a function to find the second element (address) given the first element (index) | Code: | signed int16 GetAddrFromIndex (int idx, int16 pAddrArray [][2], int ArrayItems)
{
int i;
for (i=0; i < ArrayItems; ++i) {
if (pAddrArray [i][0] == idx)
return pAddrArray [i][1];
}
return -1; // indicates not found
}
| This will flat not work (at least in the version 5.035 compiler). It compiles ok but always returns the wrong value. It always returns the value of the next higher index instead of the address associated with idx. Also it is just about impossible to get the debugger show the value that pAddrArray [I][n] is pointing to. I had to break it down and return the values in local variables and then I could see what was going wrong but it still does not work. The same code works when compiled with the visual studio C compiler. I finally had to do this to make it work: | Code: | signed int16 GetAddrFromIndex (int idx, int16 pAddrArray [][2], int ArrayItems)
{
int i;
int16 ix, addr;
int16 *p;
for (i=0; i < ArrayItems; ++i) {
p = pAddrArray + i*2;
ix = p [0];
addr = p [1];
if (ix == idx)
return addr;
}
return -1; // indicates not found
}
|
Over the years I have run into a number of situations like this, where the compiler just would not do what it is supposed to. It always takes a lot of time to figure it out and find a work around, and that is made worse by the difficulties with the debugger. I seldom submit bug reports because I have to get on with my projects, especially after wasting a day figuring it out, but I find it hard to believe that a serious bug like that has not been discovered by others and submitted. And doesn't CCS have a standard set of test programs that they run new versions of the compiler through?
Russ |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|