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 ?

structs ???, WHATS WRONG ?

Discuss PocketC for CE (including Desktop Edition)

Postby brendan on Fri Apr 27, 2001 12:22 am

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);
}
brendan
 
Posts: 114
Joined: Tue Feb 20, 2001 2:28 am

Postby Justinespinosa on Fri Apr 27, 2001 2:24 am

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

OUTS Softwares
Justinespinosa
 
Posts: 156
Joined: Wed Dec 06, 2000 2:30 pm
Location: Switzerland

Postby guy on Fri Apr 27, 2001 8:00 am

How about adding typedef Kevin?

Or do auto typedef like C++ classes?


(Always pushing the envelope...)


Guy
Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
guy
 
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom

Postby guy on Fri Apr 27, 2001 8:03 am

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
Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
guy
 
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom

Postby cao on Fri Apr 27, 2001 1:16 pm

The bad news is that PocketC current design doesnot allow me to support pointer to struct.
I tried.
cao
 
Posts: 60
Joined: Tue Dec 05, 2000 4:11 am
Location: USA

Postby olegyk on Thu May 03, 2001 5:19 pm

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>
olegyk
 
Posts: 6
Joined: Thu May 03, 2001 5:00 pm


Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 3 guests

cron