• LCrawford (unregistered)

    reTERN $"{Frist:0000}";

  • bvs23bkv33 (unregistered)

    oh yeah, write about converting cobol to java

  • Little Bobby Tables (unregistered) in reply to bvs23bkv33

    Funny you should say that, because we did just that back in the final dying days of C20. And yes, we had to directly emulate the system we were replacing, bugs and all. Which we did, faithfully. Then we went back and negotiated with the customer to actually fix those bugs -- which of course we now knew were there -- and re-calculate his legacy of data, this time without the inaccuracies caused by the bugs.

    We managed to pay our bills that year.

  • spadgas (unregistered)

    And writing to buffer3 and outbuff would crash with most of the compilers/runtimes I know, as they'll be pointing to bytes in read-only memory

  • someone (unregistered)

    Hey look, Remy didn't open with his latest adventures!

    Was he listening, or am I just seeing correlations without corresponding causation?

  • Doh (unregistered)

    "Note also the check if (OutVal >= 100)- OutVal holds the leftmost two characters of csHold2- so it will never be greater than or equal to 100."

    Maybe note the statement right above it, where the rounding could increment OutVal. Or is the real WTF that 99 + 1 is not >= 100?

  • Brian (unregistered)

    I always cringe when I see (supposedly) C++ code with upfront variable declarations. It's a huge red flag that whoever wrote the code is stuck in an old C mentality and doesn't really understand all the advances in software development, both conceptually and syntactically, since sometime around the '80s.

  • Stu (unregistered)

    "C++ didn’t include standard rounding methods for most of its history"

    What? C++ has included the "cmath" (a copy of C's "math.h") header since forever... That includes all the standard rounding functions.

  • Kashim (unregistered)

    Any port from language to language should involve some minor level of refactoring, at least to take advantage of now-built-in calls that were not built in before.

  • HK-47 (unregistered) in reply to Brian

    I always cringe when I see code without upfront variable declarations because it is a telltale sign of writing code out of your ass instead from the flowchart you made before you started coding.

  • Nobody (unregistered) in reply to HK-47

    | ... from the flowchart you made before you started coding.

    Maybe Brian is right - some developers are stuck in the '80s.

    And why do you think, that a flowchart mandates upfront variable declarations?

  • (nodebb) in reply to HK-47

    This. The only time I feel justified creating variables in the middle is a loop iterator or using statement. Otherwise people leave unused or repurposed variables everywhere, to say nothing of pages and pages of tightly coupled spaghetti.

    Addendum 2018-10-10 17:22: Sorry, redundant instead of repurposed.

  • löchlein deluxe (unregistered) in reply to HK-47

    Don't remind me… I'm working on legacy Perl code that has frickin' use/require statements in subs. (For those of you lucky enough to avoid Perl, that's having an import statement in a function.) With absolute path names to the library. I wonder if TDWTF will accept a submission that is an entire virtual machine image.

  • Yazeran (unregistered) in reply to löchlein deluxe

    use/require statement inside a subroutine; What was they thinking???? And absolute path as icing on top.

    Ok I have made some pretty bad Perl code in my time (some 15 years ago I used $var = cat $file instead of opening the file file normally, Yes bad I know), but not once have I been even tempted to do anything like that.

    That is the IT equivalent of like putting land mines on a playground....

    Yours Yazeran Plan: To go to Mars one day with a hammer.

  • (nodebb) in reply to Kashim

    After verifying that the built-in call does exactly the same thing as the code you're replacing with it, of course.

  • onlyme (unregistered)

    "it [OutVal] will never be greater than or equal to 100."

    Is it just me, or is it perfectly possible for OutVal to be 100?

    OutVal starts out as a conversion of the leftmost two characters from a string to a long. Then depending on the value of the third character in the string (ChkDigit), OutVal gets incremented by one. So if the string starts with something in the range "995" - "999" OutVal will be 100.

    What I really want to know is where "m_round" comes from?!?

Leave a comment on “Round Two”

Log In or post as a guest

Replying to comment #:

« Return to Article