| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Passing a var. |
FA> NO WAY, NO HOW am i getting into a C vs. C++ argument, FA> but if i had to use structures and pass them to individual FA> functions, i would assume that a single class using local FA> (to it) variables would speed things up. Member functions access class variables via the invisible 'this' pointer. There is an implied "this->" before each variable reference that belongs to the current class. The advantage in C++ is not in execution time (it offers none), but in DEVELOPMENT time, and in writing succinct code that is potentially more easily maintained. Naturally, a butcher is not skilled to do brain surgery, so a poor programmer often does not know how to use the tool and just as often makes the task more difficult again by using C++ features to obscure rather than enlighten. FA> Having said that, the class may take longer to initialize, FA> setup in memory or whatever else. ?? Why? In C, to do the same thing, you'd have to do pretty much the same task. FA> Didn't have time to test it for speed, but the latter ""looks"" more FA> efficient, the C++ version sets up a fair bit of extra data into the asm FA> output. Looks can, and often are, deceiving. The entire idea behind C++ is to make less headaches for the developer, not necessarily make code run any faster. FA> c2.exe Average elapsed time = 0.0253956 seconds FA> c1.exe Average elapsed time = 0.0245724 seconds FA> c1.exe is 0.0008232 seconds faster than c2.exe Hint: when conducting timing tests, test multiple iterations - in the order of 1000's of them. One iteration is basically useless for all intents and purposes and it proves little except that you might have been holding your tongue a particular way, or that your cache wasn't flushed in one instance and maybe was in another. --- 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™.