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

MichaƂ Kamburelis michalis at camelot.homedns.org
Mon Apr 28 10:03:15 CEST 2003


Hi,

I already sent this letter but I had not received any answer. So I'm 
repeating it now. Below is a description of some small (but important 
for some parts of my code) bug in FPC 1.0.7 (only in 1.0.7, it works 
fine in 1.0.6 and recent 1.1) and an idea of some really small 
improvement that could be added to the compiler. Please, I'm waiting for 
any response, especially about that bug. I know my English is not too 
good (but I'm trying), if what I wanted to say in this letter was not 
clear - answer something and I'll try to explain it better.

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 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.

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 for any response,
Michalis Kamburelis,
michalis at camelot.homedns.org




More information about the fpc-devel mailing list