[fpc-pascal]runtime 201 with swapword function
memsom at interalpha.co.uk
Fri Jul 25 17:36:39 CEST 2003
Doesn't system contain a routine called 'swap' that does this exact thing??
This program would seem to work in both Delphi and FPC1.1:
i, j: word;
i := $9988;
writeln( IntToHex(i, 4) ); //output '9988'
j := swap( i );
writeln( IntToHex(j, 4)); //output '8899'
No need to go to the trouble of writing your won routine!! ;-)
> Why does the following result in a runtime error ?
> program example;
> THE_PORT = 9999;
> function swapWord(w: Word): Word;
> swapWord := (w SHL 8) OR (w SHR 8);
> port: Word;
> port := swapWord(THE_PORT)
> $ ./swapword
> Runtime error 201 at 0x08052AA2
> -Zero Defect Software Engineers Group - ZDSEG
> -You need only two tools. WD-40 and duct tape.
> -If it doesn't move and it should, use WD-40.
> -If it moves and shouldn't, use the tape.
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
More information about the fpc-pascal