Archive: Size of int in nsis


Size of int in nsis
  Hi,

is it safe to assume that an int in nsis has always the size of 4 bytes? or is this platform dependet?

I have an NSDialog with a multiselection Listbox which I query in the following way:
(LB_GETSELITEMS places an array of ints at the given address)


#get maximum of selected items

>SendMessage $ListBox ${LB_GETCOUNT} $0 $0 $itemCount

>#allocate memory for $itemCount integers
>IntOp $0 $itemCount * 4
System
::Alloc $0
Pop $address

>#place indices of selected items in the allocated memory
>SendMessage $ListBox ${LB_GETSELITEMS} $itemCount $address $selItemCount

>${For} $R1 1 $selItemCount

#get current index
System::Call "*$address(i .r1)"
MessageBox MB_OK "$1"

#move to next index
IntOp $address $address + 4

>${Next}

>System::Free $address
>
I wonder if the addition of 4 to the current address will always give the correct result, even on a 64bit os for example?

Integers in NSIS are currently treated as 32-bit. It's possible that a switch to x64 would cause them to be treated as 64-bit. But for now, it's 32-bit. If you want, the System plug-in has System::Int64Op.