I still don't get 1<<30, what does it do?
On Nov 5, 2013 11:30 AM, "Camilo Aguilar" <camilo....@gmail.com> wrote:
> I still don't get 1<<30, what does it do?
just an arbitrary big number (hopefully big enough for your slice length/capacity) for the length of the array, so that you can slice it with the length you want.
On Nov 5, 2013 2:17 PM, "Camilo Aguilar" <camilo....@gmail.com> wrote:
>
> how would it be if I know the length of the C array?
it you know the length statically (that you can write down the number in source code as a constant), you can use that constant as the array length.
but if it is stored in a variable, you will have to use the 1<<30 trick, because arrays in Go must have statically determined bounds.