Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-12

bug in 1.0.10? sizeof(cmyclass) returns instance size

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Anton Tichawa

Hello, List!

Using ppc386 version 1.0.10, sizeof(cmyclass) returns the size of the instance, e. g. 260 when there is one 'string' member, whereas ppc386 version 1.0.6 returns the expected size of a pointer, 4. Is this a bug, or a deliberate change?

$: cat top/testsize.pas
program testsize;
type
  my_class = class
    fname: string;
  end;
begin
  writeln(sizeof(tobject));
  writeln(sizeof(my_class));
end.

Son Dez 14 00:12:49 /io
$: /usr/bin/ppc386 top/testsize.pas
Free Pascal Compiler version 1.0.10 [2003/06/26] for i386 Copyright (c) 1993-2003 by Florian Klaempfl
Target OS: Linux for i386
Compiling top/testsize.pas
Assembling testsize
Linking /io/obj/testsize
12 Lines compiled, 0.0 sec
Son Dez 14 00:13:00 /io
$: obj/testsize
4
260

Thank You!

Anton.

Peter Vreman
to Anton Tichawa
you wrote 6 lines
Hello, List! Using ppc386 version 1.0.10, sizeof(cmyclass) returns the size of the instance, e. g. 260 when there is one 'string' member, whereas ppc386 version 1.0.6 returns the expected size of a pointer, 4. Is this a bug, or a deliberate change?

It is a bug. It is already fixed in 1.9.0

Peter