| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Passing a var. |
FA> Does passing a pointer to a function effect performance, as opposed to FA> having the contents of said pointer global or local ? The only differences is the overhead associated with passing any parameter. A parameter is a relative (to the stack) address, whereas a global is not. Same issue, and it really doesn't much matter about the data type. For the sake of 99.9999% of applications, the 'overhead' of using a relative address is irrelevant. FA> Also, does re-entrancy mean, that one can have multiple instances of a FA> function/program ? Reentrancy means that a function can be called more than once, even at the same time or recursively, and each invocation will not affect the other. It means that the function can be REENTERED. In the C library, for example, there are some functions which are not re-entrant. Like strtok(), since it stores its own static 'state' information that is modified each time it is called. So you can't for example, expect that this state information will not change whenever it is called. In a multithreaded environment (such as OS2), where you have pseudo-simultaneous execution of different threads, if each thread called the same non-reentrant function at the same time, they would tend to interfere with each other. I should add that for strtok() and similar C library functions, most OS/2 multithreaded libraries actually work around this by having separate static state information for each thread, and other functions that are not strictly reentrant such as printf() use semaphores to ensure that only one thread can execute it at the same time. Reentrancy is an issue also when you want a function to be reusable, and you don't want to have to worry about when and where you call it. Reentrant functions tend to use and work with parameters and auto variables only, and avoid using (non-const) static data at all. --- MaltEd/2 1.0.b6* Origin: Unique Computing Pty Limited (3:632/348) SEEN-BY: 50/99 620/243 623/630 632/103 107 348 360 633/371 634/388 396 SEEN-BY: 635/301 502 503 506 544 639/252 711/401 409 410 413 430 808 809 932 SEEN-BY: 711/934 712/515 713/888 714/906 800/1 @PATH: 632/348 635/503 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™.