Soft Declare Usage Question (REALbasic network user group Mailinglist archive)
Back to the thread list
Previous thread: error starting RB 2010r1
Next thread: Changing window frame type for different platforms
| Re: messy waveforms - Rubber Chicken Software Co. | ||
| Soft Declare Usage Question - Karen | ||
| Re: Soft Declare Usage Question - Charles Yeomans | ||
| Re: Soft Declare Usage Question - Kem Tekinay | ||
| Soft Declare Usage Question |
| Date: 02.03.10 21:54 (Tue, 02 Mar 2010 15:54:47 -0500) |
| From: Karen |
|
I've no done much with declares before and have a question.
Outside of possibly executable size (and excluding maintainability/readability issues) would having the same soft declares "declared" in many many different methods cause any issues with performance, memory issues or stability on any platform? What I'm working on will be Xplatform... Ideally i would like to encapsulate everything in one class. If I put the declares i separate methods I would need different methods for each platform. That would be a lot of shared methods on one class. I'm think most of the time it would be better in this case just to repeat the declares for each high level method for each platform within "#if Target*" blocks. I'm also thinking having the declare calls embedded in each method would be faster than call out to RB methods multiple times in the higher level methods. If I go the separate methods in a module route (rather not) is defining a soft Declare as an external function more efficient than wrapping them in RB methods? I don't see anything in the UserGuide or Language reference on External Functions. Is using then for soft declares for different platforms OK as the IDE does not let us specify a platform for an external function. For Soft declares i would assume it would be OK unless we accidentally call them on the wrong platform. Thanks for any opinions - Karen _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html> |
| Re: Soft Declare Usage Question |
| Date: 02.03.10 23:39 (Tue, 2 Mar 2010 17:39:46 -0500) |
| From: Charles Yeomans |
|
On Mar 2, 2010, at 3:54 PM, Karen wrote: > I've no done much with declares before and have a question. > > Outside of possibly executable size (and excluding maintainability/ > readability issues) would having the same soft declares "declared" > in many many different methods cause any issues with performance, > memory issues or stability on any platform? > > What I'm working on will be Xplatform... Ideally i would like to > encapsulate everything in one class. If I put the declares i > separate methods I would need different methods for each platform. > That would be a lot of shared methods on one class. > > I'm think most of the time it would be better in this case just to > repeat the declares for each high level method for each platform > within "#if Target*" blocks. I'm also thinking having the declare > calls embedded in each method would be faster than call out to RB > methods multiple times in the higher level methods. > > If I go the separate methods in a module route (rather not) is > defining a soft Declare as an external function more efficient than > wrapping them in RB methods? I don't see anything in the UserGuide > or Language reference on External Functions. Is using then for soft > declares for different platforms OK as the IDE does not let us > specify a platform for an external function. For Soft declares i > would assume it would be OK unless we accidentally call them on the > wrong platform. > I almost always use soft declares. When we had both PEF and Mach-O builds, a few functions had to be declared without the 'soft' keyword. And I recall that invoking softly-declared functions is sufficiently slower than the alternative that in a rare loop, I might just declare them. I deal with these issues on all three platforms, and in my experience the answer is "it depends". When you find, though, that attempting to stick to one class is becoming difficult, you might abandon that idea. Charles Yeomans _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html> |
| Re: Soft Declare Usage Question |
| Date: 02.03.10 23:14 (Tue, 02 Mar 2010 17:14:10 -0500) |
| From: Kem Tekinay |
|
On 3/2/10 3:54 PM, "Karen" <<email address removed>> wrote:
> Is using then for soft declares for different platforms OK as the IDE does not > let us specify a platform for an external function. For Soft declares i would > assume it would be OK unless we accidentally call them on the wrong platform. You can do this: #if TargetWindows soft declare win_function ... #elseif TargetMac soft declare mac_function ... #else soft declare linux_function ... #endif I'd wrap that into an RB method to standardize the way your code and outside code accesses it. I don't know if that's less efficient or not, but it's certainly much easier to maintain. I'm about to put my M_Random on my web site (soon, I hope) that uses just this technique. For the case where the Windows and Mac declares are just too different, or there is just too much code to keep readable in one method, I expose one public method that calls the appropriate private method for the platform. Specifically: function RandomMemoryBlock( mbSize As Integer ) As MemoryBlock #if TargetWindows return pRandomMB_Win( mbSize ) #elseif TargetMac return pRandomMB_Mac( mbSize ) ... Etc. ... HTH. __________________________________________________________________________ Kem Tekinay (212) 201-1465 MacTechnologies Consulting Fax (914) 242-7294 http://www.mactechnologies.com To join the MacTechnologies Consulting mailing list, send an e-mail to: <email address removed> _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html> |
Links
MBS Realbasic PDF Plugins - Nachhilfe Nickenich