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 - Cutt'n Code (Whats Best)

Cutt'n Code (Whats Best)

Discuss PocketC for CE (including Desktop Edition)

Postby brendan on Thu Feb 22, 2001 9:35 pm

Howdy all, I've a Q

whats better, and why ?

#resourse 1 "fred.bmp"
x = loadres(1);
drawbitblt(x,10,10);
drawbitblt(x,50,50);
etc


or

#resource 1 "fred.bmp"
drawbitblt(loadres(1),10,10);
drawbitblt(loadres(1),50,50);
etc
brendan
 
Posts: 114
Joined: Tue Feb 20, 2001 2:28 am

Postby stephane on Fri Feb 23, 2001 2:51 am

That depends, what is your definition of "better" ? <img src=icon_smile.gif border=0 align=middle>

Disclaimer: I'm a PalmOS user, so any answer I may give could be proven wrong by one of the WinCE gurus out there. I'm answering based on my understanding, just to get the thread going <img src=icon_smile_wink.gif border=0 align=middle>

In theory, the first example would be faster, because the res is only loaded once, at the expense of using memory. The speed factor could be moot, though, as the res is already in RAM.. (not like it's being loaded from disk as on a desktop..)

So, based on the same points, the second example is slower, but will only use memory temporarily.

So, if speed is the concern, test them both and time it.

Did I pass the test? (sorry, but the way your Q is worded, it's -so- much like an exam question) <img src=icon_smile.gif border=0 align=middle>


St?ɬ©phane
Stéphane
stephane
 
Posts: 71
Joined: Fri Jan 12, 2001 3:16 am
Location: Canada

Postby Justinespinosa on Fri Feb 23, 2001 4:46 am

Hi Palm OS user.

What you said is not really true because loadres(1) didn't load anything in the memory except a string. The resource is a file that is stord in the "\tmep" directory and loadres() just returns the name of this file.

But i think the first one is faster too. And it's easier for the programmer to read is code (if the var is not called x)<img src=icon_smile_wink.gif border=0 align=middle>
<pre id=code><font face=courier size=2 id=code>
#resourse 1 "fred.bmp"

string fred_bmp_res ;
fred_bmp_res = loadres(1);

drawbitblt(fred_bmp_res,10,10,0); // bitblt needs 4 parameters <img src=icon_smile.gif border=0 align=middle>
drawbitblt(fred_bmp_res,50,50,0);
</font id=code></pre id=code>
or
<pre id=code><font face=courier size=2 id=code>
#define FRED_BMP_RES 1
#resourse FRED_BMP_RES "fred.bmp"

string fred_bmp_res ;
fred_bmp_res = loadres(FRED_BMP_RES );

drawbitblt(fred_bmp_res,10,10,0); // bitblt needs 4 parameters <img src=icon_smile.gif border=0 align=middle>
drawbitblt(fred_bmp_res,50,50,0);
</font id=code></pre id=code>

Is better because if you want to add a resource before "fred.bmp", you will not need to seek the code until you find loadres(1). Just to change the value of FRED_BMP_RES. This is called structure a code

J.Espinosa

OUTS Softwares

Edited by - justinespinosa on 02/22/2001 22:47:54
J.Espinosa

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


Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 2 guests

cron