Re: Translate small Perl to equivalent VB6?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Bob O`Bob (filterbob_at_yahoogroups.com)
Date: 09/27/04


Date: Mon, 27 Sep 2004 12:49:51 -0700

Larry Serflaten wrote:

> When I went to see what you meant, that's when I saw that some ranges simply
> were not working correctly. To get that algorithm to work with VB there would
> be three possible routes to take;
>
> 1. Factor out the special cases where the sign bit is a problem and handle them
> individually
>
> 2. Use a different data type that does not have a sign bit (like Currency)
>
> 3. Convert to using strings to represent the binary values and twiddle those
> strings as if they were bits.
>
> Unfortunately, #2 and #3 are not compatable with VB's logical operators (And,
> and Or), so #1 is left as the more logical choice, although I think I'd go for #2
> because the conversion to and from the X.X.X.X format would be fairly easy and
> a person can make their own bitwise And and Or functions for Currency values.

I definitely favor #1 ... as evidenced by posted code.

One routine (RangeToBlocks1, about 40 lines of code) pretty much JUST
handles the sign bit, then in turn calls the other main routine
(RangeToBlocks2, also about 40 lines of code) to do the rest of the job.

        Bob



Relevant Pages

  • Re: Fortran or C
    ... The only C routine I would really call a string routine, ... Several routines that create strings *from* ... Although at the library level you can't truly check subscripts/sizes; ... not necessarily the result of subscript errors, ...
    (comp.lang.fortran)
  • Re: A fast way to judge an anagram
    ... To judge whether two strings are anagrams, ... You write both a reliable test routine and a fast routine. ...
    (comp.programming)
  • Re: OT. Good programming techniques (or not)...
    ... It's very easy to turn an Oroutine ... >> That is instantly Owith respect to the length of somestring. ... Pascal has counted strings. ... out unless it were deep in some oft-executed loop. ...
    (uk.comp.sys.mac)
  • Changing the color of strings on the fly
    ... Using C5.5EE Ver G ... I need to change the colour of 10 pairs of strings on a screen as ... hangs. ... If I disable the routine it works fine. ...
    (comp.lang.clarion)