Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2017-12

FPC 3.0.4 DOS GO32V2

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lubomír Čabla

Hi,

in new version 3.0.4 you have changed the declaration of some procedures and functions in the go32 unit.

It does not matter, but I see a little mismatch for linear base address:

FPC 3.0.2

  function get_segment_base_address(d : word) : longint;
  function set_segment_base_address(d : word;s : longint) : boolean;

FPC 3.0.4

  function get_segment_base_address(d : word) : longint;
  function set_segment_base_address(d : word;s : dword) : boolean;

For get_segment_base_address is correct longint or dword?

Thanks for the help.

Nikolay Nikolov
to Lubomír Čabla
Lubomír Čabla wrote 18 lines
Hi, in new version 3.0.4 you have changed the declaration of some procedures and functions in the go32 unit. It does not matter, but I see a little mismatch for linear base address: FPC 3.0.2 function get_segment_base_address(d : word) : longint; function set_segment_base_address(d : word;s : longint) : boolean; FPC 3.0.4 function get_segment_base_address(d : word) : longint; function set_segment_base_address(d : word;s : dword) : boolean; For get_segment_base_address is correct longint or dword?

I think (and I'm the one, who made the change) dword is more correct, because segment bases can be >=2GB and longint is signed, so results in a negative number. In theory, it should only matter if you have range checking turned on, but I think 32-bit linear addresses should only be declared as dword (or longword) and previous code, that used longint, or added longint typecasts to avoid range check errors should be fixed. Maybe I should document it in:
http://wiki.freepascal.org/User_Changes_3.0.4 ? I kinda skimped on that, because it only affects existing code, when range checking is on, and usually range checking is turned off for low level selector manipulating code.

Best regards,
Nikolay

Marco van de Voort
to Nikolay Nikolov

In our previous episode, Nikolay Nikolov said:

Show quoted text 7 lines
> > function get_segment_base_address(d : word) : longint; > function set_segment_base_address(d : word;s : dword) : boolean; > > For get_segment_base_address is correct longint or dword? I think (and I'm the one, who made the change) dword is more correct, because segment bases can be >=2GB and longint is signed, so results in

(I think he also meant having a signed getter and unsigned setter)

Tomas Hajny
to Nikolay Nikolov: I think (and I'm the one, who made the change) dword is more correct, because segment…
Nikolay Nikolov wrote
On 12/02/2017 10:50 PM, Lubomír Čabla wrote:

Hi,

Show quoted text 17 lines
> FPC 3.0.2 > > function get_segment_base_address(d : word) : longint; > function set_segment_base_address(d : word;s : longint) : boolean; > > FPC 3.0.4 > > function get_segment_base_address(d : word) : longint; > function set_segment_base_address(d : word;s : dword) : boolean; > > For get_segment_base_address is correct longint or dword? I think (and I'm the one, who made the change) dword is more correct, because segment bases can be >=2GB and longint is signed, so results in a negative number. In theory, it should only matter if you have range checking turned on, but I think 32-bit linear addresses should only be declared as dword (or longword) and previous code, that used longint, or added longint typecasts to avoid range check errors should be fixed.

That makes sense (and DJGPP sources assume the same), but get_segment_base_address should probably return a dword as well then, right?

Show quoted text 5 lines
Maybe I should document it in: http://wiki.freepascal.org/User_Changes_3.0.4 ? I kinda skimped on that, because it only affects existing code, when range checking is on, and usually range checking is turned off for low level selector manipulating code.

Yes, adding a note there would be better.

Tomas

Nikolay Nikolov
to Tomas Hajny
Tomas Hajny wrote 25 lines
On Sun, December 3, 2017 22:10, Nikolay Nikolov wrote: > On 12/02/2017 10:50 PM, Lubomír Čabla wrote: Hi, >> FPC 3.0.2 >> >> function get_segment_base_address(d : word) : longint; >> function set_segment_base_address(d : word;s : longint) : boolean; >> >> FPC 3.0.4 >> >> function get_segment_base_address(d : word) : longint; >> function set_segment_base_address(d : word;s : dword) : boolean; >> >> For get_segment_base_address is correct longint or dword? > I think (and I'm the one, who made the change) dword is more correct, > because segment bases can be >=2GB and longint is signed, so results in > a negative number. In theory, it should only matter if you have range > checking turned on, but I think 32-bit linear addresses should only be > declared as dword (or longword) and previous code, that used longint, or > added longint typecasts to avoid range check errors should be fixed. That makes sense (and DJGPP sources assume the same), but get_segment_base_address should probably return a dword as well then, right?

That is true. I've missed that one, unfortunately :( I'll probably fix this in trunk tomorrow.

Show quoted text 8 lines
> Maybe I should document it in: > http://wiki.freepascal.org/User_Changes_3.0.4 ? I kinda skimped on that, > because it only affects existing code, when range checking is on, and > usually range checking is turned off for low level selector manipulating > code. Yes, adding a note there would be better.

Ok, added it.

Nikolay

Lubomír Čabla
to Nikolay Nikolov

Thanks to all for help.

Nikolay Nikolov wrote 55 lines
On 12/03/2017 11:44 PM, Tomas Hajny wrote: > On Sun, December 3, 2017 22:10, Nikolay Nikolov wrote: > >> On 12/02/2017 10:50 PM, Lubomír Čabla wrote: >> > > Hi, > > FPC 3.0.2 >>> >>> function get_segment_base_address(d : word) : longint; >>> function set_segment_base_address(d : word;s : longint) : boolean; >>> >>> FPC 3.0.4 >>> >>> function get_segment_base_address(d : word) : longint; >>> function set_segment_base_address(d : word;s : dword) : boolean; >>> >>> For get_segment_base_address is correct longint or dword? >>> >> I think (and I'm the one, who made the change) dword is more correct, >> because segment bases can be >=2GB and longint is signed, so results in >> a negative number. In theory, it should only matter if you have range >> checking turned on, but I think 32-bit linear addresses should only be >> declared as dword (or longword) and previous code, that used longint, or >> added longint typecasts to avoid range check errors should be fixed. >> > That makes sense (and DJGPP sources assume the same), but > get_segment_base_address should probably return a dword as well then, > right? > That is true. I've missed that one, unfortunately :( I'll probably fix this in trunk tomorrow. > > > Maybe I should document it in: >> http://wiki.freepascal.org/User_Changes_3.0.4 ? I kinda skimped on that, >> because it only affects existing code, when range checking is on, and >> usually range checking is turned off for low level selector manipulating >> code. >> > Yes, adding a note there would be better. > Ok, added it. Nikolay _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal