Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a difference between TParallel.&For and TParallel.For?

Is there a difference between TParallel.&For and TParallel.For ?

Both can be compiled in Delphi 10 Seattle. so which one should I stick to?

like image 613
justyy Avatar asked Oct 08 '15 11:10

justyy


1 Answers

The method definition for TParallel.&For requires the ampersand to escape a reserved word (for). You don't need to use it when calling the method except in cases where there would be ambiguity.

For example :

 with TParallel do begin
    &For(...)  // etc 
 end;

I can't imagine why you would ever want to do that, however.

If it were in one of your own classes, mind you, any internal calls to an escaped method would require either the ampersand or an explicit class or instance (self) identifier.

TParallel is a sealed class, so the point is moot in this case. You will never be working within it or within a descendent class.

like image 200
J... Avatar answered Oct 24 '22 02:10

J...