[fpc-devel]Small bug in fpc 1.0.7 and an idea of some small improvement

Michalis Kamburelis michalis at arthur
Mon Apr 7 14:44:50 CEST 2003


Hi,

I recently downloaded a snapshot of fpc 1.0.7 and found a small bug in it :
     const s = SizeOf(TObject);
doesn't work (compiler "Error: Illegal expression"). This is not related
only to TObject, it will not work with any class name. And if I declare
some variable of type class (like
     var V:TObject;
     const S = SizeOf(V);
) it will not work  too.
And it will not work in ANY constant expression, e.g.
     type T = array[0..SizeOf(TObject)]of Integer;
doesn't work too.

I downloaded 1.0.7 snapshot at 1st of April.

I know that always SizeOf(TObject) = SizeOf(Pointer) = 4 (at least on
32-bit processors) but I'm using some macros that declare types using
constant SizeOf(TYPE_NAME) where TYPE_NAME is another macro (and
TYPE_NAME may be but doesn't have to be some class type). So using
SizeOf(<class-name>) is useful for me. And it works with fpc 1.0.6 and
it works with recent fpc 1.1 (downloaded at the same day, 1st of April).

I have also an idea of some small improvement. I can use #INCLUDE
<file-name> in fpc config files (like fpc.cfg). But when I use relative
file names for <file-name> they are resolved with respect to the
directory where currently compiled Pascal source file is located in.
Wouldn't it be better if relative <file-name> be resolved with respect
to the directory where current config file is ?

I know my english isn't too good so I better give an example of what I
mean. Assuming I have some program in file /progs/prog.pas I would
like to compile it with command
     fpc @/configs/config1.cfg /progs/prog.pas
where
[contents of file /configs/config1.cfg]
     #INCLUDE config2.cfg
[contents of file /configs/config2.cfg]
     ... some configuration directives for fpc ...

Currently this doesn't work with any fpc version. Fpc wants to find
included file config2.cfg in directory /progs/.

Thanks in advance for any response,
Michalis Kamburelis,
michalis at camelot.homedns.org



More information about the fpc-devel mailing list