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 - What Am I Doing Wrong?(V2)(Right Forum Now!)

What Am I Doing Wrong?(V2)(Right Forum Now!)

Discuss PocketC for CE (including Desktop Edition)

Postby parker2r on Tue Mar 27, 2001 2:29 pm

Being new to the Ipaq and Pocket C Desktop and Device development, I thought I'd start of with something simple. When I downloaded the 'bit1' sample program to the Ipaq, it ran fine. However, when I tried to download the source file to the Ipaq to edit it, the device development editing package didn't want to know. Also, when I hand transcribed the 'bit1' program on the Ipaq, I got an 'expected token ,' error message when I copied, word for word, 'int num = 0;' What's going on?
after I substituted int num; num = 0;
I got past the error, but came to grief on 'bit_count'. Help!Being new to the Ipaq and Pocket C Desktop and Device development, I thought I'd start of with something simple. When I downloaded the 'bit1' sample program to the Ipaq, it ran fine. However, when I tried to download the source file to the Ipaq to edit it, the device development editing package didn't want to know. Also, when I hand transcribed the 'bit1' program on the Ipaq, I got an 'expected token ,' error message when I copied, word for word, 'int num = 0;' What's going on?
after I substituted int num; num = 0;
I got past the error, but came to grief on 'bit_count'. Help!
//bit1
main()
{
int num = 0;
num = gets("Please enter a positive number: ");
alert("Number " + num + " has " + bit_count(num) + " bits");

}

bit_count(int x)
{
int n = 0;

if (x)
do {
n++;
} while ((x = x & (x-1)));

return(n);
}
parker2r
 
Posts: 3
Joined: Tue Mar 27, 2001 8:24 am
Location: United Kingdom

Postby wolfgang on Tue Mar 27, 2001 3:40 pm

Hi,

you must place the bit_count function BEFORE the code where you call it, i.e. before your "main" function. Then it will work.

Another possibility is to use a prototype, i.e. leave the bit_count function where it is, but add the following line BEFORE your "main" function:

bit_count(int x);

(do not forget the semicolon at the end of this line! It tells PocketC that this is only a prototype (defining the interface to the function) and not a full function definition.)

Your grief with the variable definition comes from the fact that PocketC for PalmOS supports initialization (something along the lines "int i=0;"), but the WindowsCE version does not.

Wolfgang
Composing music on the PocketPC! - http://www.pdamusician.com
wolfgang
 
Posts: 281
Joined: Tue Dec 12, 2000 4:22 am
Location: USA

Postby parker2r on Tue Mar 27, 2001 5:26 pm

Thanks, Wolfgang. I am sure you are right about the initialisation. However, I am still puzzled by the fact that I can look at the source code on the desktop developer edition, download it to the Ipaq, and it runs--yet I can't type in exactly the same code directly on the Ipaq and compile it successfully.
parker2r
 
Posts: 3
Joined: Tue Mar 27, 2001 8:24 am
Location: United Kingdom

Postby Admin on Wed Mar 28, 2001 1:18 am

device currently using v2 compiler which cannot handle initialization.
desktop currently using v3 compiler which can handle initialization.
device beta v3 can handle initialization. still in beta.

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Thanks, Wolfgang. I am sure you are right about the initialisation. However, I am still puzzled by the fact that I can look at the source code on the desktop developer edition, download it to the Ipaq, and it runs--yet I can't type in exactly the same code directly on the Ipaq and compile it successfully.


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Admin
 
Posts: 86
Joined: Fri Oct 06, 2000 6:00 am
Location: USA


Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 2 guests

cron