TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Rowan Crowe
from: Frank Adam
date: 1996-08-22 10:37:00
subject: Passing a var.

G'Day Rowan,
 
-=> Quoting Rowan Crowe to Frank Adam <=-
 RC> * Frank Adam writes to All, on Saturday August 17 1996
 RC> at 04:57:
 
 FA> Does passing a pointer to a function effect performance, as opposed to
 FA> having the contents of said pointer global or local ?
 RC> Don't quite understand this one. Do you mean storing the 
 RC> return value in a global variable?
No, here is an example..


struct strct
{
 int x,y,z;
 };

struct strct s;  

int myfunc();
int myfunc2(struct strct *s);

main()
{
 myfunc();
 myfunc2(&s);
 return 0;
 } 

Assume both function do the same according to s, would there be a notable 
speed difference ? Especially in a library, where a number of functions 
would take s as a control parameter.
I'm in the process of making up a library, that may have more than one 
copies running at any time. If i do it in C i'll have to have a number of 
instances of the struct and pass it to the functions.
If i find that it slows execution too much i may have to opt for C++ and 
classes, but being a library speed diffs may not really show up until it's 
used in a "real" application. 

 RC> Re-entrancy means you can call the procedure while it's
 RC> already in the middle of being executed, without clobbering 
 RC> all your variables. Some things such as sorts and 
So i was roughly on the right track, comparing it to multiple instances.


  L8r Frank (fadam{at}ozemail.com.au).
  
___ Blue Wave/DOS v2.21

--- Maximus 3.01
@Via illegal copy of FastEcho at 3:50/99
* Origin: The Software Parlour (3:635/544)
SEEN-BY: 50/99 620/243 623/630 632/349 635/503 544 727 711/401 409 410 413
SEEN-BY: 711/430 808 809 932 934 712/515 713/888 714/906 800/1
@PATH: 635/544 50/99 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.