The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,810 other followers

Archive for the ‘F2084’ Category

When you are bitten by normally having the luxury of a current development environment

Posted by jpluimers on 2011/10/06

Sometimes you are at clients that don’t fully appreciate the luxury of keeping their development environment current.

This case a client still using Delphi 2006, where I promptly ran into a compiler error that was solved 5 years ago: a “F2084 Internal Error: C11919” at the end of the method.

begin
  if RMQResult.Create(CompCode, Reason).IsOK then
//...
end; // [Pascal Fatal Error] MQObjects.pas(668): F2084 Internal Error: C11919

The cause is that the compiler barfs at calling a method on a freshly created record.
The function result is an intermediate, which is not handled correctly (fixed in Delphi 2007).

This is not only for record intermediates: reusing an intermediate like the result of Pred() will crash the compiler in Delphi 2006.

The workaround is introducing a real variable.
This works:

var
  MQResult: RMQResult;
begin
  MQResult := RMQResult.Create(CompCode, Reason);
  if MQResult.IsOK then
//...
end; // compiles fine

–jeroen

Posted in Delphi, Development, F2084, Software Development | 4 Comments »

Delphi – for … in on enumerated data types

Posted by jpluimers on 2009/10/27

I like enumerated type a lot.
The allow you to perfectly describe what the members of such a type actually mean, much more readable than a bunch of integer constants!

Given an enumerated type like TTraphicLightColors

type
  TTraphicLightColors = (Red, Orange, Green);

I always wondered why  – since the for ... in statement was added to the structured statements part of the Delphi language – it is not possible to use a for … in statement like the this:

</span>
<pre>var
  TraphicLightColor: TTraphicLightColors;
begin
  try
    for TraphicLightColor in TraphicLightColor do
      ShowValueAsTraphicLightColor(Ord(Value));
    // [DCC Error] EnumerationEnumeratorDemoProcedures.dpr(63): E2430 for-in statement cannot operate on collection type 'TTraphicLightColors'
end;

Somehow, for … in expects a collection type.
A request for [WayBack] the for … in do on enumerated types compiler feature is in QC, but it is closed with reason “Won’t do”.

Back in Delphi 2007, I tried working around this by writing a type implementing the GetEnumerator pattern myself, but got [WayBack] Internal Errors when compiling anything but the most basic sample.

Until today, where I found how I could get that most basic sample to work!
It is an example on how you could implement this: it is research, so you decide if you find the result practical enough to use yourself.

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Development, Event, F2084, QC, Software Development | 20 Comments »

 
%d bloggers like this: