I have two lines of code:
_iEditField = (_k + _j) + IDC_EDIT_0001 ;
GetDlgItemText(hMainWindow,_iEditField,_lpszTmp,sizeof(_szTmp)) ;
I woulid like to know if I change in:
GetDlgItemText(hMainWindow,(_k + _j) + IDC_EDIT_0001,_lpszTmp,sizeof(_szTmp)) ;
is more efficient or if the comoiler does it at my place?
Second question:
I have a char variable _szTmp[1024] it is often used in a loop.
Is it better to have a pointer on that variable or not.
alignas(int) char _szTmp[1024] ;
alignas(LPSTR) LPSTR _lpszTmp ;
_lpszTmp = _szTmp ;
for(_i = _iStart ; _i < _iEnd ; _i++)
{
for(_j = _iStart ; _j < _iEnd ; _j++)
{
_iEditField = (_k + _j) + IDC_EDIT_0001 ;
GetDlgItemText(hMainWindow,_iEditField,_lpszTmp,sizeof(_szTmp)) ; // Removed _szTmp
lpCurrentFilter->Filter.Matrix[_iIndice] = atoi(_lpszTmp) ; // Removed _szTmp
_iIndice++ ;
}
_k += MAX_EDIT_COLUMNS ;
}
For me the compiler must generate something like LEA RAX,_szTmp followed by PUSH RAX.
When using _lpszTmp the code woud be PUSH [_lpszTmp + RIP] The best use would that this is in a register.
Is it better and exact?