Forum > FPC development

Feature idea: array [10] of integer

(1/5) > >>

v.denis:
I've just created patch http://bugs.freepascal.org/view.php?id=27377
for declaring array range in C way with just count of elements.


--- Code: ---type
  // low is implicit 0, high is 9
  TArr1 = array[10] of integer;
--- End code ---

This topic is if someone want to say something.

I personally don't see a big problem as it seems it is not breaking code.
It just offers one more way to declare array.

airpas:
less typing is always good .

BeniBela:
Cool!

Hope it does not derail this thread, but I have another wish.


--- Code: --- 
  const arr: array[] of integer = (1, 2, 3, 4, 5);
  //length would be infered to be 5, with low 0, high 4

--- End code ---

User137:
Both static and dynamic arrays too?

--- Code: ---// Static
const arr: array[] of integer = (1, 2, 3, 4, 5);
var arr: array[] of integer = (1, 2, 3, 4, 5);

// Dynamic (can change size later)
var arr: array of integer = (1, 2, 3, 4, 5);
--- End code ---

edit: typo

marcov:



Or maybe even


--- Code: ---
{$mode cascal}

const arr: [] of int = {1, 2, 3, 4, 5};

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version