Array of pointers to QUANTUM pointers

Casper Boemann cbr at boemann.dk
Tue Jun 28 15:06:24 CEST 2005


On Tuesday 28 June 2005 14:57, Michael Thaler wrote:
> Hello,
>
> I need to create some temporary arrays which store pixel data. For one
> array I can do
>
>  QUANTUM * tmp = new QUANTUM[ width * m_pixelSize * sizeof( QUANTUM ) ];
>
> which works fine.
First, you should use QUANTUM but Q_UINT8, but thats only cosmetic
also drop the sizeof() that is already handled by m_pixelSze

> If I try to make an array with pointers to these arrays 
> with
>
> QUANTUM **tmpRows = new QUANTUM[ width * m_pixelSize * sizeof( QUANTUM ) ]
> [ (int)(fwidth * 2 + 1) ];

That wont get you an array of pointers but a multidimensional array

> I get a compile error:
>
> I really don't know what this means. How can I create an array of
> QUANTUM * tmp = new QUANTUM[ width * m_pixelSize * sizeof( QUANTUM ) ];?
you cannot creat a multidimensional array with both dimensions calculated on 
the fly. The compiler needs to know the dimensions of the smaller dimension

But as that was not what you set out to create that won't be a problem.


Hey boundewijn and bart: don't take the words out of my mouth. I'll post 
anyway now that I have written it
-- 
best regards / venlig hilsen
Casper Boemann


More information about the kimageshop mailing list