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:
{$t-}
type
pw = ^word;
var
w: pw;
begin
w:=nil;
inc(w)
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
>
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
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
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
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
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
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
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
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
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
On Thu, 01 May 2008 15:23:29 +0200
Marc Weustink <[EMAIL PROTECTED]> wrote:
> Mattias Gaertner wrote:
>[...]
> > ReAllocMem(p,0);
>
> Ah, now I understand why you use them :)
>
> Anyway does it set p:=nil ?
Yes.
Mattias
___
fpc-pascal maillist - fp
Mattias Gaertner wrote:
On Wed, 30 Apr 2008 01:22:47 +0200
Marc Weustink <[EMAIL PROTECTED]> wrote:
Alan Krause wrote:
Hans MÃ¥rtensson wrote:
But that would not work after the pointer was used and then it's
memory freed.
So a better way might be:
Always when declaring pointers do it this w
On Wed, 30 Apr 2008 01:22:47 +0200
Marc Weustink <[EMAIL PROTECTED]> wrote:
> Alan Krause wrote:
> > Hans MÃ¥rtensson wrote:
> >> But that would not work after the pointer was used and then it's
> >> memory freed.
> >> So a better way might be:
> >>
> >> Always when declaring pointers do it this
Alan Krause wrote:
Hans MÃ¥rtensson wrote:
But that would not work after the pointer was used and then it's
memory freed.
So a better way might be:
Always when declaring pointers do it this way:
var p: ^sometype = nil;
Then in stead of using the freemem, define your own procedure:
procedur
Hans MÃ¥rtensson wrote:
But that would not work after the pointer was used and then it's
memory freed.
So a better way might be:
Always when declaring pointers do it this way:
var p: ^sometype = nil;
Then in stead of using the freemem, define your own procedure:
procedure myfreemem(var p: p
Joao Morais wrote:
Jonas Maebe wrote:
On 29 Apr 2008, at 15:35, Zaka E-Lab wrote:
It's possible to give a default initialization value to a defined type?
No, that is not possible.
Except if your pointer is declared as a member of a class (which is
always assigned to nil by default)
Jonas Maebe wrote:
On 29 Apr 2008, at 15:35, Zaka E-Lab wrote:
It's possible to give a default initialization value to a defined type?
No, that is not possible.
Except if your pointer is declared as a member of a class (which is
always assigned to nil by default)
___
On 29 Apr 2008, at 15:35, Zaka E-Lab wrote:
It's possible to give a default initialization value to a defined
type?
No, that is not possible.
Jonas
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/li
It's possible to give a default initialization value to a defined type?
I suppose that it isn't, but it would be to easy to resolve that trouble
that way.
Anyway, I appreciate your help and support.
Thanks.
Zaka.
Jonas Maebe escribió:
It cannot know that without help. You have to do such book
On 29 Apr 2008, at 14:48, Zaka E-Lab wrote:
I don't create anything, the memory is allocated by the create
procedure. How can the procedure know if the argument is a pointer
already allocated or not?
It cannot know that without help. You have to do such bookkeeping
yourself (e.g., as mentio
Maybe I haven't explain it correctly. What I want is to construct a
Unit that contains some procedures, one of them is
create(var p : PStruct), and other is delete(var p : PStruct).
I don't create anything, the memory is allocated by the create
procedure. How can the procedure know if the argumen
You can assign "nil" to the pointer before using it, then check if PStruct =
nil it wasn't
created.
Leonardo.
--- Zaka E-Lab <[EMAIL PROTECTED]> wrote:
> I have something like this:
>
> PStruct = ^Struct;
> Struct = record
> num: integer;
> end;
>
> I have a unit to ha
FPC-Pascal users discussions
Subject: Re: [fpc-pascal] Pointers
On Thursday 28 July 2005 06:11, Leonhard Holz wrote:
> If you really want mode $13 you need to compile for dos, cause then
> windows sets up an old-style 8086 environment. Unfortunately the
> download page says:
>
> On Thursday 28 July 2005 06:11, Leonhard Holz wrote:
>
>> If you really want mode $13 you need to compile for dos, cause then
>> windows sets up an old-style 8086 environment. Unfortunately the
>> download page says:
>>
>> "Sorry, no Dos release yet. The Dos platform is missing a maintainer
>> an
On Thursday 28 July 2005 06:11, Leonhard Holz wrote:
> If you really want mode $13 you need to compile for dos, cause then
> windows sets up an old-style 8086 environment. Unfortunately the
> download page says:
>
> "Sorry, no Dos release yet. The Dos platform is missing a maintainer
> and is not
On 7/28/05, Leonhard Holz <[EMAIL PROTECTED]> wrote:
> Hello,
>
> If you compile a win32-program you will have a total virtual memory,
> that means that your pointer values don't have anything to do with the
> physical ram. A pointer associated to $a actually points to nowhere.
>
ok...thanks
Hello,
Note that those addresses (like $a000) are all things from the 16-bit
world. I'm not sure how far these are emulated correctly if you are
running in a 32-bit world. Addresses for graphics cards are way different
there, easier to use, but different from card to card.
If you compile a win
On Wed, 27 Jul 2005 20:55:34 -0300
Daniel Franzini <[EMAIL PROTECTED]> wrote:
> Hi everyone
>
> I'm just trying to compile and execute a simple example from a
> graphics programming tutorial under FPC. Here is the code
>
Note that those addresses (like $a000) are all things from the 16-bit
worl
El Mié 27 Jul 2005 20:14, Daniel Franzini escribió:
> no, i didn't...but it worked and the program did compiled...now, it
> shows the following message
>
> Runtime error 216 at $00401034
> $00401034
>
> but i think that this is some windows (2000) issue not FPC one...
New versions of WinNT (Incl.
Daniel Franzini wrote:
no, i didn't...but it worked and the program did compiled...now, it
shows the following message
Runtime error 216 at $00401034
$00401034
but i think that this is some windows (2000) issue not FPC one...so i
ask: is there any way of running these simple examples or i wil
Maybe free pascal supports the "absolute" directive ;)
something like:
var
SomeAddress : pointer absolute $a000;
- Original Message -
From: "Daniel Franzini" <[EMAIL PROTECTED]>
To:
Sent: Thursday, July 28, 2005 1:55 AM
Subject: [fpc-pascal] Pointers
Hi everyone
I'm just trying
Daniel Franzini wrote:
BEGIN
InitGraph;
Screen := MEM[$A000]; { Set up the screen buffer pointer }
<---here is the error
WHILE NOT KeyPressed DO
SetPixel(
RANDOM(320), { Random X (Range 0-319) }
RANDOM(200), { Random Y (Range 0-199) }
RAN
33 matches
Mail list logo