× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 2011/11/30 12:26 PM, David Gibbs wrote:
... The function I'm enhancing is already embedded pretty deep in the
RPG code ... ripping it out and re-engineering it would be very
difficult and probably cause a significant performance problem.


Since it's an existing function, I'm wondering if null-terminating the data will cause a problem? If not a logic problem, possibly a performance problem, since much of your data will probably have to be copied to temps to add the null-terminators.

It can be tricky to use the C str functions with data that isn't normally null-terminated. Tricky in general, and also tricky to ensure correctness. It's easy to miss coding errors because uninitialized storage is often x'00', so a function can appear to be working correctly when it's only working accidentally.

I have scars ... strcpy and strcat are especially creepy since they assume the target is big enough to hold the source value plus the null terminator.

It might be worthwhile to write your own versions of scan, subst etc using the MEM functions that Mark Waterbury mentioned, instead of embarking on a null-terminated voyage.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.