[fpc-pascal] Re: String type compatibility

Sven Barth pascaldragon at googlemail.com
Wed Apr 3 16:40:30 CEST 2013


Am 03.04.2013 16:25, schrieb Xiangrong Fang:
> > It's because in Pascal you need to declare types first.
>
> But why array[0..10] of Integer, or string[255] are not "types"?  
> Remember that you can use "open array" in function params anyway.
>
They are types, but anonymous ones.

Also do not confuse open arrays with dynamic arrays. Open arrays can 
only be used for function/procedure parameters and you can pass dynamic 
arrays, static arrays or array constructors ( e.g. [10, 2, 4]), but you 
can only pass dynamic arrays to dynamic array parameters (which can only 
be done if you use a declared dynamic array type). Also you can't return 
"open arrays".

Regards,
Sven



More information about the fpc-pascal mailing list