[fpc-pascal] Mozilla XPCOM

Marcos Douglas md at delfire.net
Mon Jun 7 16:59:56 CEST 2010


On Mon, Jun 7, 2010 at 11:34 AM, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
>
> On 07 Jun 2010, at 16:30, Marcos Douglas wrote:
>
>> 2010/6/7 Jonas Maebe <jonas.maebe at elis.ugent.be>:
>>>
>>> a) in Pascal, the behaviour of const is completely undefined (the
>>> compiler
>>> can do whatever it wants)
>>
>> The compiler can do whatever is wants?!
>
> At the implementation level, yes.

Well... just to I will know. A long time ago (Delphi 4) I learned:
Always use 'const' for 'strings' because this is faster. Strings will
be passed by reference. This remains true?

eg:

var str: string;

procedure Foo1(const s: string);
procedure Foo2(s: string);

I know in Foo1 the 's' parameter is readonly and in Foo2 not.
But Foo1 and Foo2 are different for the compiler at the level
otimization, even I not change the 's' value inside the procedure?

Thanks and sorry for the newbie question  ;-)


Marcos Douglas



More information about the fpc-pascal mailing list