[chuck-users] Object array initialization
Ge Wang
gewang at CS.Princeton.EDU
Thu Jul 13 12:36:16 EDT 2006
Hi Ollie!
Which platform are you running? Also, can you include the
greater program, or more of the context? I can't seem to
reproduce the crash on OS X using the following code:
---
public class X
{
int hi;
fun void boo()
{ <<< hi >>>; }
}
class Y
{
X xs[];
init( 4 );
fun void init( int num )
{
X x[num] @=> xs;
for( int i; i < num; i++ )
i => xs[i].hi;
}
}
// make y
Y y;
// print
for( int i; i < y.xs.cap(); i++ )
y.xs[i].boo();
---
It may be a chuck bug elsewhere...
Best,
Ge!
On Jul 13, 2006, at 12:11 PM, Ollie Glass wrote:
> I'm trying to declare an object array and initialize it later in a
> function:
>
> Channel channels[];
> initChannels(4, 16);
>
> fun void initChannels(int num, int length) {
> Channel ch[num] @=> channels;
> ...
>
> This gives a segmentation fault, and trying like this:
>
> fun void initChannels(int num, int length) {
> channels[num];
>
> gives a bus error. How should this be done?
>
> Thanks always,
>
> Ollie
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
More information about the chuck-users
mailing list