Re: [fpc-pascal] Pointers

2010-02-11 Thread Mattias Gaertner
On Thu, 11 Feb 2010 21:53:59 +0100 Rainer Stratmann wrote: > Am Thursday 11 February 2010 21:24:03 schrieb Ralf A. Quint: > > At 12:07 PM 2/11/2010, Jonas Maebe wrote: > > >On 11 Feb 2010, at 18:17, Rainer Stratmann wrote: > > >>In the past with the turbopascal compiler and other always sizeof >

Re: [fpc-pascal] Pointers

2010-02-11 Thread David Emerson
On Thu 11 Feb 2010, Rainer Stratmann wrote: > How can I have access to position 4 of a pointer? > > var > p : pbyte; > c : char; > s : ansistring; > x : longint; > > s := 'Hello'; > p := @s; > x := 4; // 4th position > c := [p+x]^ ??? how to get access to the 'o' c := (p+x)^; // why w

Re: [fpc-pascal] Pointers

2010-02-11 Thread Ralf A. Quint
At 12:53 PM 2/11/2010, Rainer Stratmann wrote: > I am fairly certain that he confuses this with the special case of > applying sizeof() to a string type, where you always get one byte > more (the preceding length byte) than the string type has been > defined, for example SizeOf (String [80]) will

Re: [fpc-pascal] Pointers

2010-02-11 Thread Rainer Stratmann
Am Thursday 11 February 2010 21:24:03 schrieb Ralf A. Quint: > At 12:07 PM 2/11/2010, Jonas Maebe wrote: > >On 11 Feb 2010, at 18:17, Rainer Stratmann wrote: > >>In the past with the turbopascal compiler and other always sizeof > >>byte was > >>added. > > > >That is not true. This program prints "2

Re: [fpc-pascal] Pointers

2010-02-11 Thread Ralf A. Quint
At 12:07 PM 2/11/2010, Jonas Maebe wrote: On 11 Feb 2010, at 18:17, Rainer Stratmann wrote: In the past with the turbopascal compiler and other always sizeof byte was added. That is not true. This program prints "2" when compiled under Turbo Pascal: I am fairly certain that he confuses thi

Re: [fpc-pascal] Pointers

2010-02-11 Thread Rainer Stratmann
Am Thursday 11 February 2010 21:07:17 schrieb Jonas Maebe: > On 11 Feb 2010, at 18:17, Rainer Stratmann wrote: > > In the past with the turbopascal compiler and other always sizeof > > byte was > > added. > > That is not true. This program prints "2" when compiled under Turbo > Pascal: Ok, sorry I

Re: [fpc-pascal] Pointers

2010-02-11 Thread Jonas Maebe
On 11 Feb 2010, at 18:17, Rainer Stratmann wrote: In the past with the turbopascal compiler and other always sizeof byte was added. That is not true. This program prints "2" when compiled under Turbo Pascal: {$t-} type pw = ^word; var w: pw; begin w:=nil; inc(w); writeln(long

Re: [fpc-pascal] Pointers

2010-02-11 Thread Micha Nelissen
Rainer Stratmann wrote: Ok, that makes some sense, but I did not know it before. In the past with the turbopascal compiler and other always sizeof byte was added. The behavior is dependent on the {$T+} (typed pointers) mode. Micha ___ fpc-pascal mai

Re: [fpc-pascal] Pointers

2010-02-11 Thread Rainer Stratmann
I thought that adding something to a pointer always adds 1 sizeof(byte) to it. So if something is added to a pointer the compiler looks the sizeof the (typed) pointer points to? Ok, that makes some sense, but I did not know it before. In the past with the turbopascal compiler and other always size

Re: [fpc-pascal] Pointers

2010-02-11 Thread Frank Peelo
So you're allowed add an integer to an untyped pointer?! Wow! Usually if you add 1 to a pointer of type t, then sizeof(t) gets added to the value of the pointer. So if p points at an array of byte, p+1 would point at the next element of the array, 1 byte after p. But if p points at an array o

[fpc-pascal] Pointers

2010-02-11 Thread Rainer Stratmann
What is the difference between A* and B*? regards, Rainer type tchararr = array[ 0..999 ] of char; pchararr = ^tchararr; http_obj = object pdata: pchararr; header_anz: longint; content_anz : longint; end; var http : http_obj; ppp : pointer; // This

Re: [fpc-pascal] values for ThreadSetPriority

2010-02-11 Thread Jonas Maebe
On 11 Feb 2010, at 01:10, Seth Grover wrote: http://www.hu.freepascal.org/docs-html/rtl/system/threadsetpriority.html says that it takes for a priority values from -15 to 15. The comment to the right of the declaration says that "0" is normal. Are these numbers like nice's, where negative numbe