Re: Help Required - compilation error.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11 August 2011 14:50, Jalaiah Murari wrote:
> Hi,
>
> I used GCC 2.7.2.3 in the past to compile the following code:
> class sample
> {
> private:
> unsigned char wk_tmp[20000 - ((int)(long)&(((DATASTRUCTURE*)0)->mydata))];
>
> };
>
>
> Now, When i try to compile using GCC 4.1.2, I get the following error for the above declaration.
> error: array bound is not an integer constant
>
>
> I see that  the array size has to be mentioned directly, instead of dynamic calculation.
> Is there any workaround for this. Do I need to turn on any flag in gcc/g++ when compiling this file.

No, the code is invalid and can't be compiled.

It looks as though you probably want to use offsetof(DATASTRUCTURE, mydata)



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux