Re: [Ql-Users] C68 arrays

2016-06-04 Thread Michael Bulford
Hi Tobias and everyone,

Many thanks for your comments.  It certainly looks like I'm accessing some 
memory that's not allowed.

The version of C68 I'm using is 424, which I believe is the latest.  The 
program is the Travelling Salesman Program, which I wrote first in SBASIC, and 
this runs faultlessly.  I then used CPORT to translate this into Cee, and now I 
am trying to get this to work properly. 
Tobias, could I send you the whole program please?  If I try to omit parts, 
then it might stop working altogether!  Could I send you a zip to your email 
address?  I could explain how to get the problem condition.

Michael
___
QL-Users Mailing List


Re: [Ql-Users] C68 arrays

2016-06-03 Thread Tobias Fröschle
Hi Derek,

yes, sure do.

Tobias


> Am 03.06.2016 um 23:45 schrieb Derek :
> 
> Hi Tobias,
> 
> Do you use MAKE to compile the C68 programs
> 
> Regards,
> 
> DerekOn 3 Jun 2016 11:48, Tobias Fröschle  
> wrote:
>> 
>> Michael, 
>> 
>> I am using C68 quite a lot on the QL and have not experienced anything like 
>> that. 
>> 
>> I would rather suppose the problem is somewhere else in your code. 
>> 
>> Can you specify the exact version of C68 you are using? 
>> Are you willing to show a minimum version of your code that exposes this 
>> apparent problem? 
>> 
>> Thanks, 
>> Tobias 
>> 
>> 
>>> Am 03.06.2016 um 12:14 schrieb Michael Bulford 
>>> : 
>>> 
>>> Hi all, 
>>> 
>>> I am developing a program in Cee which uses several arrays, and which is 
>>> crashing. 
>>> Eg. ..  int array[101]; and using elements from 0 up to 100. 
>>> I have discovered that by declaring the array with one extra element cures 
>>> the problem, 
>>> Eg. ..  int array[102]; and again using only elements up to 100. 
>>> This seems to happen with both global arrays, or arrays created from 
>>> malloc, 
>>> although the crash is different in either case. 
>>> I was wondering if anyone has experienced this as well. 
>>> 
>>> 
>>> Kind regards, 
>>> Michael Bulford 
>>> ___ 
>>> QL-Users Mailing List 
>> 
>> ___ 
>> QL-Users Mailing List 
> ___
> QL-Users Mailing List

___
QL-Users Mailing List

Re: [Ql-Users] C68 arrays

2016-06-03 Thread Derek
Hi Tobias,

Do you use MAKE to compile the C68 programs

Regards,

DerekOn 3 Jun 2016 11:48, Tobias Fröschle  wrote:
>
> Michael, 
>
> I am using C68 quite a lot on the QL and have not experienced anything like 
> that. 
>
> I would rather suppose the problem is somewhere else in your code. 
>
> Can you specify the exact version of C68 you are using? 
> Are you willing to show a minimum version of your code that exposes this 
> apparent problem? 
>
> Thanks, 
> Tobias 
>
>
> > Am 03.06.2016 um 12:14 schrieb Michael Bulford 
> > : 
> > 
> > Hi all, 
> > 
> > I am developing a program in Cee which uses several arrays, and which is 
> > crashing. 
> > Eg. ..  int array[101]; and using elements from 0 up to 100. 
> > I have discovered that by declaring the array with one extra element cures 
> > the problem, 
> > Eg. ..  int array[102]; and again using only elements up to 100. 
> > This seems to happen with both global arrays, or arrays created from 
> > malloc, 
> > although the crash is different in either case. 
> > I was wondering if anyone has experienced this as well. 
> > 
> > 
> > Kind regards, 
> > Michael Bulford 
> > ___ 
> > QL-Users Mailing List 
>
> ___ 
> QL-Users Mailing List 
___
QL-Users Mailing List

Re: [Ql-Users] C68 arrays

2016-06-03 Thread Norman Dunbar
Alternatively, are you running through an array from 0 to 100 but comparing 
with some other element, say in a bubble sort, where that other element is some 
positive offset from the current index in the loop?

Been there, done that! 

Cheers, 
Norm. 
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
QL-Users Mailing List


Re: [Ql-Users] C68 arrays

2016-06-03 Thread Norman Dunbar
Hi Michael,

Sounds like an off by one error.

Do you use for loops? While loops. Do loops? Etc to process elements in the 
array? If so, do you have a # define to limit the array index to 100 rather 
than using some embedded magic number? 

#define LIMIT 101
...
int index;
int array[LIMIT];
for (index=0; index < LIMIT; index++) {
do_stuff (array [index]);
...
}

And apologies if granny already knows how to suck eggs!

Somewhere in your code there's most likely an array indexing operation that's 
gone over the 101th array entry.

HTH 

Cheers, 
Norm. 
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
QL-Users Mailing List


Re: [Ql-Users] C68 arrays

2016-06-03 Thread Marcel Kilgus
Michael Bulford wrote:
> I am developing a program in Cee which uses several arrays, and which is 
> crashing.
> Eg. ..  int array[101]; and using elements from 0 up to 100.
> I have discovered that by declaring the array with one extra element cures 
> the problem,
> Eg. ..  int array[102]; and again using only elements up to 100.
> This seems to happen with both global arrays, or arrays created from malloc,
> although the crash is different in either case.
> I was wondering if anyone has experienced this as well.

I'm with Tobias here. That there is a problem with statically
allocated arrays is already highly unlikely as this would break
basically every program in existence. That there is both a problem
with static and malloc() arrays is basically impossible.

Your code is certainly accessing some memory past the allocated array
at some point.

Marcel

___
QL-Users Mailing List


Re: [Ql-Users] C68 arrays

2016-06-03 Thread Tobias Fröschle
Michael,

I am using C68 quite a lot on the QL and have not experienced anything like 
that.

I would rather suppose the problem is somewhere else in your code.

Can you specify the exact version of C68 you are using?
Are you willing to show a minimum version of your code that exposes this 
apparent problem?

Thanks,
Tobias


> Am 03.06.2016 um 12:14 schrieb Michael Bulford :
> 
> Hi all,
> 
> I am developing a program in Cee which uses several arrays, and which is 
> crashing.
> Eg. ..  int array[101]; and using elements from 0 up to 100.
> I have discovered that by declaring the array with one extra element cures 
> the problem,
> Eg. ..  int array[102]; and again using only elements up to 100.
> This seems to happen with both global arrays, or arrays created from malloc,
> although the crash is different in either case.
> I was wondering if anyone has experienced this as well.
> 
> 
> Kind regards,
> Michael Bulford
> ___
> QL-Users Mailing List

___
QL-Users Mailing List


[Ql-Users] C68 arrays

2016-06-03 Thread Michael Bulford
Hi all,

I am developing a program in Cee which uses several arrays, and which is 
crashing.
Eg. ..  int array[101]; and using elements from 0 up to 100.
I have discovered that by declaring the array with one extra element cures the 
problem,
Eg. ..  int array[102]; and again using only elements up to 100.
This seems to happen with both global arrays, or arrays created from malloc,
although the crash is different in either case.
I was wondering if anyone has experienced this as well.


Kind regards,
Michael Bulford
___
QL-Users Mailing List