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 - Compile Errors I can't figure out...

Compile Errors I can't figure out...

Discuss PocketC for Palm OS (including Desktop Edition)

Postby Glasswalker on Wed Mar 21, 2001 12:26 am

Ok here is the deal... I am in the middle of writing a program on PocketC that is rather large (source is up around 45K right now) and I am trying to get this one module to compile, but the problem is that I have my program broken up into each function being a seperate module (notepad file) but... one of my functions is larger than the 4K limit... and would be an extreme pain in the butt to cut up... so I tried this:

Example program:

// file1.c
function()
{
if(value==value)
{
code;
more code;
...
}
if(value==value)
{
code;
more code;
...
}
include "file2.c"

// file2.c

if(value==value)
{
code;
more code;
...
}
if(value==value)
{
code;
more code;
...
}
}

That is the brief on what it does (it is basically a huge case select statement, so it takes like 45 different if statements. I had to cut them into 2 files so it would fit in the notepad, but when I try to compile it goes through my whole program fine, then it gives the error: Line 203 "confused in expression"

When I click "Goto" to see where the error is it puts the cursor right over the E on the word include, at the end of file1.c
I can't figure out for the life of me why this is happening unless you can only include a complete function... which is kinda dumb because then I am completely screwed... in this case how would anybody suggest I fix this????
Glasswalker
 
Posts: 47
Joined: Wed Mar 21, 2001 12:18 am
Location: Canada

Postby Vilmos on Wed Mar 21, 2001 2:13 am

I believe you found the problem. It is hard to say without the actual code there, but I'm betting you can't include a partial function. Splitting up your huge case is probably what you are going to end up doing. Time to factor out the code and see if you can reduce the code size. Can you pull out the code from some of the if statements and then just call functions? Those functions could be in the other included file.

My only other thought is that you might be running out of memory on the Palm. I had problems compiling when the program got too large.

Vilmos
Vilmos
 
Posts: 174
Joined: Tue Dec 05, 2000 6:13 pm
Location: Canada

Postby Thad on Wed Mar 21, 2001 8:15 am

Or it could be because

include "..."

Should be

#include "..."

That said, Vilmos is right in saying that your function should be split into smaller functions. Generally speeking, if you have a function that big then there is a better way of doing it!

Thad

Thad
Thad
Thad
 
Posts: 33
Joined: Thu Feb 22, 2001 10:27 am
Location: United Kingdom

Postby Tom Miller on Wed Mar 21, 2001 3:05 pm

Try something like the following:
(assume value=[0..30]
if(value>0&&value<15) doFirstSetofCaseStatements();
else if(value>=15&&value<31) doSecondSetofCaseStatements();

Now you can split into two memos.

But the REAL way to fix this is for the compiler to accept DOC files!

Regards,
Tom Miller
Tom Miller
 
Posts: 80
Joined: Thu Mar 15, 2001 2:27 pm

Postby jstadolnik on Wed Mar 21, 2001 6:36 pm

PocketC can compile memos larger than 4k, the problem is with the Memo Pad app (it only allows editing up to 4k). Try using Pedit32 (you can get it at palmgear), it allows you to edit memos up to 32k in size (which is actually the palmOS limit).

If you do go with the "function" select route, check out item #14 in my optimization post (in the knowledge base). It will speed up your 45 if's significantly.

Joe
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby Tom Miller on Wed Mar 21, 2001 7:46 pm

Yeah, I tried PEdit, but the 32k limit means I still have to break up my code. I bought WordSmith after demo-ing PEdit. Boy was Pedit SLOOOOOOW when editing large docs! I mean hit-a-key-and-wait kind of slow. Hopefully version 5.0 is MUCH faster for all those that bought it.

Regards,
Tom Miller
Tom Miller
 
Posts: 80
Joined: Thu Mar 15, 2001 2:27 pm

Postby jstadolnik on Wed Mar 21, 2001 8:03 pm

I mention Pedit32 because pocketC will automatically pull it up if a compile error is encountered (instead of Memo Pad).

It is generally good practice to break source code up into smaller pieces. It can make the code much more reusable and readable.

Joe
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 2 guests

cron