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;
>
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 );
writ
On Sat, 26 Jul 2003, James Mills wrote:
> Hi,
>
> Why does the following result in a runtime error ?
>
> program example;
>
> const
> THE_PORT = ;
>
> function swapWord(w: Word): Word;
> begin
> swapWord := (w SHL 8) OR (w SHR 8);
> end;
>
> var
> port: Word;
> begin
>
On Fri, Jul 25, 2003 at 04:30:35PM +0200, Florian Klaempfl wrote:
> James Mills wrote:
> >On Fri, Jul 25, 2003 at 04:21:36PM +0200, Jonas Maebe wrote:
> >
> >>On vrijdag, jul 25, 2003, at 16:22 Europe/Brussels, James Mills wrote:
> >>
> >>
> >>>Why does the following result in a runtime error ?
> >
> On Fri, Jul 25, 2003 at 04:21:36PM +0200, Jonas Maebe wrote:
> >
> > On vrijdag, jul 25, 2003, at 16:22 Europe/Brussels, James Mills wrote:
> >
> > >Why does the following result in a runtime error ?
> > >
> > >program example;
> > >
> > >const
> > > THE_PORT = ;
> > >
> > >function swapW
On Fri, Jul 25, 2003 at 04:30:24PM +0200, Jonas Maebe wrote:
>
> On vrijdag, jul 25, 2003, at 16:32 Europe/Brussels, James Mills wrote:
>
> >>In Pascal, all calculations are performed using the base type (which
> >>is
> >>longint in FPC), so if w > 255, then w shl 8 > high(word) and will
> >>res
James Mills wrote:
On Fri, Jul 25, 2003 at 04:21:36PM +0200, Jonas Maebe wrote:
On vrijdag, jul 25, 2003, at 16:22 Europe/Brussels, James Mills wrote:
Why does the following result in a runtime error ?
program example;
const
THE_PORT = ;
function swapWord(w: Word): Word;
begin
[EMAIL PROTECTED] wrote:
Why does the following result in a runtime error ?
program example;
const
THE_PORT = ;
function swapWord(w: Word): Word;
begin
swapWord := (w SHL 8) OR (w SHR 8);
end;
How can I correct this ?
This bit of code was taken directly from server.pp in one of the old
2002
On vrijdag, jul 25, 2003, at 16:32 Europe/Brussels, James Mills wrote:
In Pascal, all calculations are performed using the base type (which
is
longint in FPC), so if w > 255, then w shl 8 > high(word) and will
result in a range check error when assigning to swapWord. Even if we
calculated everyth
On vrijdag, jul 25, 2003, at 16:22 Europe/Brussels, James Mills wrote:
Why does the following result in a runtime error ?
program example;
const
THE_PORT = ;
function swapWord(w: Word): Word;
begin
swapWord := (w SHL 8) OR (w SHR 8);
end;
In Pascal, all calculations are perfo
On Fri, Jul 25, 2003 at 04:21:36PM +0200, Jonas Maebe wrote:
>
> On vrijdag, jul 25, 2003, at 16:22 Europe/Brussels, James Mills wrote:
>
> >Why does the following result in a runtime error ?
> >
> >program example;
> >
> >const
> > THE_PORT = ;
> >
> >function swapWord(w: Word): Word;
>
11 matches
Mail list logo