Re: Critical section ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jason (yo_at_yo.com)
Date: 12/21/04


Date: Tue, 21 Dec 2004 12:01:54 -0500


"Mihajlo Cvetanovic" <mac@RnEeMtOsVeEt.co.yu> wrote in message
news:41C7E19D.7080902@RnEeMtOsVeEt.co.yu...
> Jason wrote:
>> I recently was asked to answer this
>>
>> ...
>>
>> void IncrementIndex(int iIndex)
>> {
>> ...
>> g_nNums[nIndex++];
>> ...
>> }
>
> You have used both nIndex and iIndex in ambiguous way, so I'll take it
> it's the same variable. Shouldn't "int iIndex" actually be "int &iIndex"?
>

yeah I made an error in my typing it is like this

void IncrementIndex(int nIndex)
{
...
    g_nNums[nIndex++];
...
}

which I realize now it should be

    g_nNums[nIndex]++;



Relevant Pages

  • Re: Critical section ?
    ... > void IncrementIndex ... You have used both nIndex and iIndex in ambiguous way, ... Shouldn't "int iIndex" actually be "int &iIndex"? ...
    (microsoft.public.vc.mfc)
  • Re: Can i use CComPtr in CSimplemap?
    ... void InternalSetAtIndex(int nIndex, const TKey& key, const TVal& val) ...
    (microsoft.public.vc.atl)
  • Re: Can i use CComPtr in CSimplemap?
    ... but CComPtr cannot use it's address if it's member 'p' isn't null ... void InternalSetAtIndex(int nIndex, const TKey& key, const TVal& val) ...
    (microsoft.public.vc.atl)
  • Critical section ?
    ... DWORD WINAPI Thread(LPVOID lpvParams) ... void IncrementIndex(int iIndex) ... How can IncrementIndex be written so that it is thread safe and won't ...
    (microsoft.public.vc.mfc)
  • Critical section ?
    ... DWORD WINAPI Thread(LPVOID lpvParams) ... void IncrementIndex(int iIndex) ... How can IncrementIndex be written so that it is thread safe and won't ...
    (alt.comp.lang.learn.c-cpp)