Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - structs ???, WHATS WRONG ?
Page 1 of 1

PostPosted: Fri Apr 27, 2001 12:22 am
by brendan
why wont the following work ???

struct a_ball
{
int color; //a ball has a color
int vel_x; //x > 0 right, x < 0 left
int vel_y; //y > 0 up, y < 0 down
int loc_x; //currect x location
int loc_y; //currect y location
};

a_ball balla;

main()
{
circle(balla.loc_x,balla.loc_y,5);
}

PostPosted: Fri Apr 27, 2001 2:24 am
by Justinespinosa
when you define a vairable, you must write the 'struct' before
i.e. struct a_ball balla;
if you don't want to write 'struct', i sugest you to this way

<pre id=code><font face=courier size=2 id=code>
struct <b>abl</b>
{
int color; //a ball has a color
int vel_x; //x > 0 right, x < 0 left
int vel_y; //y > 0 up, y < 0 down
int loc_x; //currect x location
int loc_y; //currect y location
};
<b>#define a_ball struct abl</b>

a_ball balla;

main()
{
circle(balla.loc_x,balla.loc_y,5);
}
</font id=code></pre id=code>

and the a_ball will be interpreted like a struct abl .


J.Espinosa

OUTS Softwares

Edited by - justinespinosa on 04/26/2001 21:25:19

PostPosted: Fri Apr 27, 2001 8:00 am
by guy
How about adding typedef Kevin?

Or do auto typedef like C++ classes?


(Always pushing the envelope...)


Guy

PostPosted: Fri Apr 27, 2001 8:03 am
by guy
And another thing...


Support for pointers to structs. It would
really help if you could get:

pMyStruct->iFieldInStruct

working.

I see loads of problems with resolving the value of the offset though. OK as long as the fields in the structs aren't ambiguous.


Guy

PostPosted: Fri Apr 27, 2001 1:16 pm
by cao
The bad news is that PocketC current design doesnot allow me to support pointer to struct.
I tried.

PostPosted: Thu May 03, 2001 5:19 pm
by olegyk
But the good news is that you can use new reference convention in V3:
<pre id=code><font face=courier size=2 id=code>
struct S { int x; string s; };

process(struct S& p) {
putsl(p.s+": "+p.x);
}

main() {
struct S a[3]; int i;
for(i=3;i--;0) {
a[i].x=i;
a[i].s="<"+i+">";
}
for(i=3;i--;0)
process(a[i]);
showconsole();
}
</font id=code></pre id=code>