Difference between revisions of "Delphi language features missing from the Free Pascal Compiler"

From Free Pascal wiki
Jump to navigationJump to search
Line 42: Line 42:
  
 
== Misc: ==
 
== Misc: ==
#{$SCOPEDENUMS ON} directive which allows to use enumeration name before the item. Example:
+
#enumeration.member notation. Example:
 
<delphi>
 
<delphi>
 
type
 
type
Line 50: Line 50:
 
end;
 
end;
 
</delphi>
 
</delphi>
 +
if {$SCOPEDENUMS ON} directive is used before the enumeration declaration then enumeration members can be referenced only by prefixing their names with enumeration name. So <b>TColor.red</b> is a valid identifier and <b>red</b> is not.
 +
 +
reference:
 +
http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/compdirsscopedenums_xml.html
 +
 
#{$pointermath ON} directive which turns on pointer arithmetic.
 
#{$pointermath ON} directive which turns on pointer arithmetic.
  

Revision as of 11:37, 23 March 2010

New since Delphi 2007

Operator Overloading Syntax for records and classes

Delphi win32 compiler supports only operators for records. .Net compiler also supports classes.

Info: http://docwiki.embarcadero.com/RADStudio/en/Operator_Overloading http://wiert.wordpress.com/2009/10/19/delphi-operator-overloading-table-of-operators-names-and-some-notes-on-usage-and-glitches/

Class Helpers

http://www.prestwood.com/ASPSuite/KB/Document_View.asp?QID=101869 http://blog.excastle.com/2007/08/29/unfinished-delphi-feature-of-the-day-virtual-class-helper-methods/

Records with Methods

New since Delphi 2009

Generics Syntax

Unicode string support

Anonymouse Methods

New since Delphi 2010

Custom Attributes

Enhanced RTTI

Class constructors and destructors

http://blogs.embarcadero.com/abauer/2009/09/03/38898

Delayed directive

Info is here: http://docwiki.embarcadero.com/RADStudio/en/Libraries_and_Packages#Delayed_Loading Some info about internals:

  1. http://blogs.embarcadero.com/abauer/2009/08/25/38894
  2. http://blogs.embarcadero.com/abauer/2009/08/29/38896
  3. http://blogs.embarcadero.com/chrishesik/2009/11/02/35056

fpc wiki about that topic: http://wiki.freepascal.org/Dynamically_loading_headers

AS and IS extended for interfaces

Info is here:

  1. http://docwiki.embarcadero.com/RADStudio/en/Interface_References#Casting_Interface_References_to_Objects
  2. http://blogs.embarcadero.com/abauer/2009/08/21/38893

Misc:

  1. enumeration.member notation. Example:

<delphi> type

 TColor = (red, green, blue);

begin

 WriteLn(ord(TColor.red));

end; </delphi> if {$SCOPEDENUMS ON} directive is used before the enumeration declaration then enumeration members can be referenced only by prefixing their names with enumeration name. So TColor.red is a valid identifier and red is not.

reference: http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/compdirsscopedenums_xml.html

  1. {$pointermath ON} directive which turns on pointer arithmetic.

Reference

  1. http://edn.embarcadero.com/article/34324
  2. http://edn.embarcadero.com/article/images/39076/New_Delphi_Coding_Styles_and_Architectures.pdf
  3. http://docwiki.embarcadero.com/RADStudio/en/What's_New_in_Delphi_and_C%2B%2BBuilder_2010