[fpc-devel] sizeof member in class procedure

Benito van der Zander benito at benibela.de
Wed Aug 15 00:30:35 CEST 2018


Hi,

why is sizeof on object/class fields sometimes allowed and sometimes not?

type TTest = object
   f: integer;
   class procedure test;
end;

class procedure TTest.test;
begin
   writeln(sizeof(f));             // does not compile
   writeln(sizeof(TTest.f));  // compiles
end;

---

type TTest = class
   f: integer;
   class procedure test;
end;

class procedure TTest.test;
begin
   writeln(sizeof(f));             // does not compile
   writeln(sizeof(TTest.f));  // does not compile
end;

surely that should all be equal to sizeof(integer)

Bye,

Benito


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180815/d9f7c4d5/attachment.html>


More information about the fpc-devel mailing list