Am 06.01.2018 12:23 schrieb "Ryan Joseph" :
> On Jan 6, 2018, at 5:25 PM, Karoly Balogh (Charlie/SGR) <
char...@scenergy.dfmk.hu> wrote:
>
> So it doesn't crash, because it never loads from this "invalid" address it
> calculates.
Are we talking about the address on the stack at compile time? If
> On Jan 6, 2018, at 5:25 PM, Karoly Balogh (Charlie/SGR)
> wrote:
>
> So it doesn't crash, because it never loads from this "invalid" address it
> calculates.
Are we talking about the address on the stack at compile time? If no memory was
ever allocated (which I thought nil suggested) then
Il 06/01/2018 01:39, Darius Blaszyk ha scritto:
#define MEMNEXT(x) ((MyStruct *)(((char *) x) - ((char *) &
(((MyStruct *)0)->next
h2pas translates it into the enclosed file.
Hope that it helps.
Giuliano
darius.pp
Description: application/wine-extension-pp
Hi,
On Sat, 6 Jan 2018, Ryan Joseph wrote:
> Also why does @(PMyStruct(nil)^.next not crash? Dereferencing and taking
> the addressing of a nil pointer sounds like a bad idea.
Because it doesn't do the actual dereferencing, because next's *VALUE* is
never used, only it's address (due to the @ op
> On Jan 6, 2018, at 1:49 PM, Karoly Balogh (Charlie/SGR)
> wrote:
>
> type
> PMyStruct = ^TMyStruct;
> TMyStruct = record
>some, fields: integer;
>next: PMyStruct;
> end;
>
> function MEMNEXT(x: Pointer): PMyStruct;
> begin
> MEMNEXT:=PMyStruct(PByte(x)-PByte(@(PMyStruct(nil)^.ne
Well, not sure why one needs to do this abomination, without knowing
the
data structure it operates on, but nevertheless, you can do the same in
Free Pascal, but you better turn the macro into a function:
Thanks Charlie!
___
fpc-pascal maillist - fp
Hi,
On Sat, 6 Jan 2018, Darius Blaszyk wrote:
> Again I would like to ask some support on a piece C code that I need to
> translate to pascal. The code in question is:
>
> #define MEMNEXT(x) ((MyStruct *)(((char *) x) - ((char *) & (((MyStruct
> *)0)->next
>
> What exactly is going on here?
Hi all,
Again I would like to ask some support on a piece C code that I need to
translate to pascal. The code in question is:
#define MEMNEXT(x) ((MyStruct *)(((char *) x) - ((char *) & (((MyStruct
*)0)->next
What exactly is going on here? Where does the result point to? It seems
like it sta