[CentOS] top and allocation issues

Michael D. Berger m_d_berger_1900 at yahoo.com
Thu Mar 3 19:46:20 UTC 2011


On Thu, 03 Mar 2011 14:34:13 -0500, m.roth-x6lchVBUigD1P9xLtpHBDw wrote:

> Michael D. Berger wrote:
>> In a context where exceptions are caught, I ran the fragment:
>>
>>    cerr << "allocating" << endl;
>>    char*    arr[100];
>>    for (int jj = 0; jj < 10; ++jj)
>>    {
> <snip>
>> Wherein do I err?
> 
> It would have been caught on 0 if that was jj++, *not* ++jj (increment
> *after* the loop, not before).
> 
>          mark

I believe that this is incorrect.  Any item in the third position
of a for(;;) is executed after the body of the loop.  In this
case ++jj and jj++ don't make any difference (except that perhaps
++jj is a little faster). In any case, the delays observed indicate
that there was one allocation.

Mike.




More information about the CentOS mailing list