Solved

Pointers, what do I do wrong here?

Posted on 2008-10-21
3
166 Views
Last Modified: 2010-04-05
var LPRGBTripleArray : ^TRGBTripleArray;
    LBitmapScanned : array[0..125] of ^TRGBTripleArray;
   
    i : Integer;
begin
  for i := 0 to 125 do
  begin
    LBitmapScanned[i] := MyBitmap.ScanLine[i];    
 
  end;
 
  LPRGBTripleArray := LBitmapScanned[0]; //compiler says that the type is different here, but it is ^TRGBTripleArray in both cases...
 
end;  

Thank you

panJames
 
0
Comment
Question by:panJames
  • 2
3 Comments
 
LVL 6

Expert Comment

by:ChristianWimmer
ID: 22768784
Define a new type called PRGBTripleArray and use it instead.
type
  PRGBTripleArray = ^TRGBTripleArray;
 
var LPRGBTripleArray : PRGBTripleArray;
    LBitmapScanned : array[0..125] of PRGBTripleArray;

Open in new window

0
 

Author Comment

by:panJames
ID: 22774357
It compiles fine now, thank you.

But what was wrong with my approach?

panJames
0
 
LVL 6

Accepted Solution

by:
ChristianWimmer earned 500 total points
ID: 22775147
You define an anonymous type (^TRGBTripleArray) for every variable declaration. Although the data structure is the same, Delphi does not consider them to be the same. They are declared twice and thus are different types. If you create a new type and let the variables use them instead, the assignment is no more a problem.
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question