C stack / heap!?

lee funnyvoice@tlabs.ac.za
Mon May 3 09:50:00 GMT 2010


Hi...

Im looking for a more precise answer! ;)

If I do this for example:

int A[12];

int main()
{
    int i = 0;
     for( i =0; i < 12; i++)
          A[i] = i+1;
    return 0;
}



int main()
{
 int A[12];
    int i = 0;
     for( i =0; i < 12; i++)
          A[i] = i+1;
    return 0;
}



where on the stack does A go? and which is faster?

I wanted to implement a ring buffer in C? but Im wondering if its faster 
to put the ring buffer array global or in a struct, or even into a c++ 
object?
for example the boost circular ( ring buffers )....

this is a general question... feel free to critique .... :P

L



More information about the Gcc-help mailing list