How to initialize a local variable in plugin?
Say I want to have something like this in c for my plugin.
int myfunction (){ int* temp;
for(int i=0; i< 4; i++){ temp[i] = i; } }
I use self var: #temp type: 'int *temp'. for int* temp
1 to: 3 do:[:i| temp at:i put: i]. for the loop.
It seems like I need to initialize temp or something.
Thanks.
It looks reasonable. Just ask vmmaker to compile the code and then look at the C output. Aik-Siong Koh
Ang Beepeng wrote:
How to initialize a local variable in plugin?
Say I want to have something like this in c for my plugin.
int myfunction (){ int* temp;
for(int i=0; i< 4; i++){ temp[i] = i; } }
I use self var: #temp type: 'int *temp'. for int* temp
1 to: 3 do:[:i| temp at:i put: i]. for the loop.
It seems like I need to initialize temp or something.
Thanks.
On 02.11.2008, at 23:06, Ang Beepeng wrote:
How to initialize a local variable in plugin?
Say I want to have something like this in c for my plugin.
int myfunction (){ int* temp;
for(int i=0; i< 4; i++){ temp[i] = i; } }
I use self var: #temp type: 'int *temp'.
Shouldn't this be
self var: #temp type: 'int *'.
? Have a look at the generated C code.
- Bert -
for int* temp
1 to: 3 do:[:i| temp at:i put: i]. for the loop.
It seems like I need to initialize temp or something.
Thanks.
squeak-dev@lists.squeakfoundation.org