[fpc-pascal] fpc has trouble with array types

Andrew Pennebaker andrew.pennebaker at gmail.com
Tue Oct 18 05:47:23 CEST 2011


But, but, the docs imply that this is the syntax for a function that returns
an array of bytes.

fpc ios7crypt.pas
ios7crypt.pas(3,25) Error: Type identifier expected
ios7crypt.pas(3,25) Fatal: Syntax error, ";" expected but "ARRAY" found
Fatal: Compilation aborted

$ cat ios7crypt.pas
program IOS7Crypt;

function XlatPrime () : array of byte;
begin
XlatPrime := (
 $64, $73, $66, $64, $3b, $6b, $66, $6f,
$41, $2c, $2e, $69, $79, $65, $77, $72,
 $6b, $6c, $64, $4a, $4b, $44, $48, $53,
$55, $42, $73, $67, $76, $63, $61, $36,
 $39, $38, $33, $34, $6e, $63, $78, $76,
$39, $38, $37, $33, $32, $35, $34, $6b,
 $3b, $66, $67, $38, $37
);
end;

function Encrypt (hash : string) : string;
begin
Encrypt := 'abc';
end;

function Decrypt (hash : string) : string;
begin
Decrypt := 'abc';
end;

var
password : string;
hash : string;
begin
password := 'abc';

hash := Encrypt(password);

password := Decrypt(hash);

write('Password: ');
 writeln(password);
end.

Cheers,

Andrew Pennebaker
www.yellosoft.us
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111017/fd1f2336/attachment.html>


More information about the fpc-pascal mailing list