[squeak-dev] Local variable in plugin

Bert Freudenberg bert at freudenbergs.de
Mon Nov 3 15:52:38 UTC 2008


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.
>




More information about the Squeak-dev mailing list