MetaTrade 4 Array++ BUG er language redefining over the years. - page 2

 

Sure, but i don't get your point. These language where before my time. And beside pascal i did not come across to any of these.

Since i learned from the beginning the C way of handling arrays with all the pro's and con's of malloc and direct access by shifting trough x*sizeOf(int) for me it is logical that the array starts with 0 and goes to lengt-1. For me it is that the way how the data is stored in the memory and the way i should access.

just my cents, z

 
zzuegg:

Sure, but i don't get your point. These language where before my time. And beside pascal i did not come across to any of these.

Since i learned from the beginning the C way of handling arrays with all the pro's and con's of malloc and direct access by shifting trough x*sizeOf(int) for me it is logical that the array starts with 0 and goes to lengt-1. For me it is that the way how the data is stored in the memory and the way i should access.

just my cents, z

Yes but they are were developed during my Life and it is what I learned first. Then C was used to create Unix. C had its troubles in getting itself standardised as I recall. Then the object orientated development method came out and about the same time C++. Mirosoft used C++ to create Windows and VB, Java I think has a similar Base development language when the internent was really begining to catch on. From what I have just been reading it would seem that the idea of limiting Arrays is being thrown out for dynamically sizing as needed See PHP as an example.

So the standardizing part of language creation seems a little confused to my OLD way of thinking.

Its slow but now I have to make sure of exact definition and meaning every time. Its like being the woman in the film 50 first dates, you wake up and have to learn about the world all over again.

 

This answer is as good as any I've seen as far as 0 based arrays go:

http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html

The crux of it is this:

"When dealing with a sequence of length N, the elements of which we wish to distinguish by subscript, the next vexing question is what subscript value to assign to its starting element. Adhering to convention a) yields, when starting with subscript 1, the subscript range 1 ≤ i < N+1; starting with 0, however, gives the nicer range 0 ≤ i < N. So let us let our ordinals start at zero: an element's ordinal (subscript) equals the number of elements preceding it in the sequence. And the moral of the story is that we had better regard —after all those centuries!— zero as a most natural number. "

 
Perhaps a vital point is being overlooked here -- MQL4 is a subset, i.e. based on, the C language. It is NOT a language defined from scratch with the aim of academic perfection. Similarly MQL5 is based on C++. Many years of experience and exposure are behind both, and it would be CRAZY for the MT developers to attempt to invent a completely new 'wheel'. What they did was a no-brainer -- pick a language-base and stick with the conventions, for better or worse.
Reason: