Rainer Stratmann wrote:
Am Saturday 02 January 2010 16:34:57 schrieb JoshyFun:
a: array[1..] or string = ('aaa', 'bbb', 'ccc');
That would be perfect.
Then you can automatically calculate the amount:
amax = sizeof( a ) div sizeof( a[ 1 ] );
If this syntax was in Pascal, would you use
On 03 Jan 2010, at 13:03, Frank Peelo wrote:
Rainer Stratmann wrote:
Am Saturday 02 January 2010 16:34:57 schrieb JoshyFun:
a: array[1..] or string = ('aaa', 'bbb', 'ccc');
That would be perfect.
Then you can automatically calculate the amount:
amax = sizeof( a ) div sizeof( a[ 1 ] );
Am Sunday 03 January 2010 13:03:37 schrieb Frank Peelo:
Rainer Stratmann wrote:
Am Saturday 02 January 2010 16:34:57 schrieb JoshyFun:
a: array[1..] or string = ('aaa', 'bbb', 'ccc');
That would be perfect.
Then you can automatically calculate the amount:
amax = sizeof( a ) div
On 03 Jan 2010, at 13:12, Rainer Stratmann wrote:
Am Sunday 03 January 2010 13:03:37 schrieb Frank Peelo:
Rainer Stratmann wrote:
Then you can automatically calculate the amount:
amax = sizeof( a ) div sizeof( a[ 1 ] );
If this syntax was in Pascal, would you use
High(a)-Low(a)+1
rather
Am Sunday 03 January 2010 13:19:39 schrieb Jonas Maebe:
On 03 Jan 2010, at 13:12, Rainer Stratmann wrote:
Am Sunday 03 January 2010 13:03:37 schrieb Frank Peelo:
Rainer Stratmann wrote:
Then you can automatically calculate the amount:
amax = sizeof( a ) div sizeof( a[ 1 ] );
If this
Rainer Stratmann schrieb:
Pascal has better ways to deal with array bounds.
But at this moment it is not possible to make a const array with auto
calculated range ( [ 1..] ). It would be easy to implement, I think.
But these things are not related. Calculating array bounds should
not be
On torstai, 31. joulukuuta 2009 16:33:50 Anthony Walter wrote:
No, the compiler will not fill in the array length based on your element
list. It does compute the length while compiling and *you* need to match it
in your declaration.
In most cases it would be better if the compiler counted the
Hello FPC-Pascal,
Saturday, January 2, 2010, 4:01:35 PM, you wrote:
JM In most cases it would be better if the compiler counted the number of
JM elements. Only in few cases the programmer really wants to limit the number
to
JM some predefined value.
JM The currently used syntax for const array
Juha Manninen schrieb:
const
a: array of string = ('aaa', 'bbb', 'ccc');
It looks like a dynamic array, but obviously is not dynamic because it is
constant. :-)
The indexing would start from 0 like with dynamic arrays.
It would not break the existing syntax and would be very intuitive.
On lauantai, 2. tammikuuta 2010 17:34:57 JoshyFun wrote:
From my point of view that's a dynamic array, if it looks like a
dynamic array ir should be a dynamic array.
It can't be dynamic because it is under const section :-)
Other pascals uses something like:
a: array[1..] or string = ('aaa',
Am Saturday 02 January 2010 16:34:57 schrieb JoshyFun:
a: array[1..] or string = ('aaa', 'bbb', 'ccc');
That would be perfect.
Then you can automatically calculate the amount:
amax = sizeof( a ) div sizeof( a[ 1 ] );
And you are free to set the number of the first array, in this case 1.
Like
Jürgen Hestermann schreef:
Juha Manninen schrieb:
const
a: array of string = ('aaa', 'bbb', 'ccc');
It looks like a dynamic array, but obviously is not dynamic because it
is constant. :-)
The indexing would start from 0 like with dynamic arrays.
It would not break the existing syntax and
12 matches
Mail list logo