Friday, September 2, 2011

Trying Delphi XE2, first impressions...

 Yesterday I downladed the 30 days demo of the brand new Delphi XE2 with 64 bits and Mac support, I want to share my feelings.

I Don't like:
-No assembler, I had to create quite a few WIN32/64 defines and then create de Pascal versions of those heavily optimized versions.
-My DirectX stuff does not work, I've to find out why...
-64 bits generated assembler code seems to be terrible!, ChessKISS is two times slower in 64 bits when it should be faster since a lot of int64 are used, I will create a more specific post about this.

I like:
-99% of the sutff compiles
-Finds unused variables that Delphi 2010 does not.
-Win64 support
-Mac support (even if I cannot try it)

Considerations:
-Casting pointers, objects or interfaces as integer does not work, one must cast them into int64

Bugs?
-D3DXVector3(-1, 0, 1) returns  "[DCC Error] BB.Screen.D3D.pas(895): E2029 ')' expected but ',' found", WTF?!, this function looks like this


//--------------------------
// 3D Vector
//--------------------------

function D3DXVector3(_x, _y, _z: Single): TD3DXVector3; inline;
begin
  with Result do
  begin
    x:= _x; y:= _y; z:=_z;
  end;
end;
-The following code gives the internal error "[DCC Fatal Error] BB.Sync.pas(1182): F2084 Internal Error: AV0A1B31D1-RFFFFFFFF-0"
constructor TFuture<T>.Create(aEvent: TNotification<T>; aPriority: TThreadPriority);
var
  e: TNotification<T>;

begin
  FResult := Default(T);
  FError := '';

  FWorker := TFutureThread<T>.Create(aEvent);
  FWorker.Priority := aPriority;
  FWorker.FreeOnTerminate := False;
end
with this workaround seems to at least compile...
constructor TFuture<T>.Create(aEvent: TNotification<T>; aPriority: TThreadPriority);
var
  e: TNotification<T>;

begin
  FResult := Default(T);
  FError := '';

  //Bloddy XE...
  e := aEvent;
  FWorker := TFutureThread<T>.Create(e);
  FWorker.Priority := aPriority;
  FWorker.FreeOnTerminate := False;
end;


-The following code does not compile, but I guess is something to do with the types of the windows function.


function GetCPUCount: integer;
var
  ProcessMask: DWORD;
  SystemMask: DWORD;

begin
  Result := 1;
  if GetProcessAffinityMask(GetCurrentProcess, ProcessMask, SystemMask) then
  begin
    while (ProcessMask <> 0) do
    begin
      if Odd(ProcessMask) then
        Inc(Result);
      ProcessMask := ProcessMask shr 1;
    end;
    Dec(Result);
  end;
end;

[DCC Error] BB.Utils.pas(1031): E2033 Types of actual and formal var parameters must be identical.

1 comment: