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);
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;
//
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
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
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
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);
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 don't
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 this
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 when compiled
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 would
On Thu, 11 Feb 2010 21:53:59 +0100
Rainer Stratmann rainerstratm...@t-online.de 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
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
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 -
I have something like this:
PStruct = ^Struct;
Struct = record
num: integer;
end;
I have a unit to handle that structure ( is a bit more complicated, but
is a good example), in this unit I have a procedure that deletes (
disposes ) the pointer. How can I know if a pointer
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 handle that
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
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
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
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
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)
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)
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:
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:
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 way:
var p:
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
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
If
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 of
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 of
-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:
Sorry, no Dos release yet
Hi everyone
I'm just trying to compile and execute a simple example from a
graphics programming tutorial under FPC. Here is the code
code
PROGRAM PixelExample;
{$MODE TP} i used tp mode because i couldn't figure out how to
do inline asm in fpc mode
USES CRT; { Include the KeyPressed
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) }
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 will just
have to set up
Maybe free pascal supports the absolute directive ;)
something like:
var
SomeAddress : pointer absolute $a000;
- Original Message -
From: Daniel Franzini [EMAIL PROTECTED]
To: fpc-pascal@lists.freepascal.org
Sent: Thursday, July 28, 2005 1:55 AM
Subject: [fpc-pascal] Pointers
Hi
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
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.
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
world. I'm
36 matches
Mail list logo