12 questions
1
vote
1
answer
183
views
Delphi open array as property index in indexed property
Is it possible to use an open array as index type for indexed properties?
unit OpenArrayAsPropertyIndex;
interface
type
TFoo = class
private
function getBar(Index: array of Integer): String;...
6
votes
1
answer
402
views
Why casting an open array parameter to an array type causes E2089 Invalid typecast?
I'm using Delphi 2007 (Pre generics) and I've defined many functions who can be used for all arrays of TObject's descendants, example:
function IndexOf(AArray : array of TObject; AItem : TObject) : ...
1
vote
0
answers
836
views
How to avoid "E2251 Ambiguous overloaded call to 'MyMethodName'" when using open array parameters?
Sometimes I get "E2251 Ambiguous overloaded call to 'MyMethodName'" when passing open arrays to overloaded methods.
Example:
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
...
1
vote
1
answer
505
views
Passing constants to a function parameter that is an open array of record
I have a record defined like this:
TRec = record
S: string;
I: Integer;
end;
I can initialize a constant of this record type like this:
const
Rec: TRec = (S:'Test'; I:123);
Now I have a ...
0
votes
1
answer
162
views
How to avoid stack overflow when passing an array to a function in C++?
I am working on a code where an array is passed to a function by passing the pointer to the first location. In the function, part of the array is used. This creates an unsafe situation because there ...
6
votes
1
answer
165
views
Cannot pass typed char array to open array of char?
When compiled under Delphi 7 or Delphi XE, the code below complains
[DCC Error] Project1.dpr(25): E2010 Incompatible types: 'array of Char' and 'TAChar'
According to Rudy's article, it should be ...
9
votes
5
answers
708
views
Cast static array to open array of different element type
(I already asked this at CodeReview where it got closed as off-topic. Hopefully it's on-topic here.)
I have a static arrays of a derived type (like LabelsA: array[0..3] of TLabel; in the following ...
9
votes
1
answer
516
views
Why can I pass a var of type X to a open array parameter of that type?
Using Delphi XE-2 (all updates applied).
I would expect the following code to generate compilation errors on the DoSomething and DoInteger calls, but it doesn't.
program OpenArrayQuestion;
{$...
0
votes
1
answer
3k
views
An Oracle stored procedure accept array(table) parameter in package example needed
This question is a part of my question how to pass javascript array to oracle store procedure by ado parameter object
I think divide it to 3 small parts will get answer faster.
For this question.
I ...
5
votes
3
answers
11k
views
How to set string (or AnsiString) constant in the TVarRec?
I want to pass the formatting arguments Args into the Format function.
I found some examples of that, but I can't find out how to assign string constant in the TVarRec member. The following code fails ...
0
votes
5
answers
337
views
How can I pass a group of objects to a function for creation?
So I'm working in Delphi 2007 and I am cleaning up my code. I have come to notice that in a great many procedures I declare a number of different variables of the same type.
for example the one ...
11
votes
3
answers
3k
views
Is a dynamic array of Char allowed when the parameter type is open array of Char?
I was looking at Delphi: array of Char and TCharArray "Incompatible Types" and started experimenting. What I discovered is rather interesting.
procedure Clear(AArray: array of Integer);
var
...