overloading function inc

Post your requests and ideas on the future development of mikroPascal.
Post Reply
Author
Message
Frank
Posts: 12
Joined: 31 Mar 2005 20:57
Location: Eindhoven, NL

overloading function inc

#1 Post by Frank » 08 Jun 2006 19:55

It would be nice if you could use the standard function inc for pointer types.

E.g. if i have an array[...] of longint and a pointer to array[0], inc(pointer) will increment by four.

Or, if this is to much effort, a sizeof function could be used instead.
Especially, when using records:

Code: Select all

type mydata=record
                         initstr    : array[0..15] of longint;
                         param1 : word;
                         param2 : array[0..3] of bit; // !!!
                         param3 : array[0..3] of bit;
                    end;
var myarray=array[0..10 of mydata;
Here, sizeof should return 19 (bytes)
so if i would be using a pointer, i could use pointer:=pointer + sizeof(mydata) although i'm using the type as param here.

Anything like this possible ?

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: overloading function inc

#2 Post by zristic » 09 Jun 2006 08:16

Errr, this is actually what compiler was supposed to do. :oops:

When you say inc(ptr) it should increment the value of ptr for the size of pointed object.

We will fix this. In the meantime, you will have to use the method you described.

Don't tell anyone. :wink:

Post Reply

Return to “mikroPascal Wish List”