[fpc-pascal]runtime 201 with swapword function
James Mills
prologic at daisy.ods.org
Sat Jul 26 07:18:12 CEST 2003
On Fri, Jul 25, 2003 at 04:36:39PM +0100, Matt Emson wrote:
>
>
> 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:
>
> program test;
> {$APPTYPE CONSOLE}
>
> uses
> sysutils;
>
> var
> i, j: word;
> begin
> i := $9988;
> writeln( IntToHex(i, 4) ); //output '9988'
> j := swap( i );
> writeln( IntToHex(j, 4)); //output '8899'
> readln;
> end.
>
> No need to go to the trouble of writing your won routine!! ;-)
I didn't write it, one of the FPC developers did last year in the
mailing list :)
cheers
James
>
> Matt
>
>
> > Hi,
> >
> > Why does the following result in a runtime error ?
> >
> > program example;
> >
> > const
> > THE_PORT = 9999;
> >
> > function swapWord(w: Word): Word;
> > begin
> > swapWord := (w SHL 8) OR (w SHR 8);
> > end;
> >
> > var
> > port: Word;
> > begin
> > port := swapWord(THE_PORT)
> > end.
> >
> > $ ./swapword
> > Runtime error 201 at 0x08052AA2
> > 0x08052AA2
> > 0x08052AC2
> > 0x080480B0
> >
> >
> > cheers
> > James
> >
> > --
> > -
> > -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
> > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> >
>
>
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
--
-
-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.
More information about the fpc-pascal
mailing list