users
[Top] [All Lists]

Re: [cinjug-users] Java vs. C

To: "Hudson, Loren (GE Infra, Aviation, Non-GE, US)" <loren.hudson@xxxxxx>
Subject: Re: [cinjug-users] Java vs. C
From: "Eric Bardes" <ericbardes@xxxxxxxxx>
Date: Mon, 15 Oct 2007 15:23:30 -0400
Cc: users@xxxxxxxxxx
Delivered-to: mailing list users@xxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=5lFD2CDuHJIDziMwtZmDyBNg/B1O2NpjSQ7w31i1v7k=; b=ijD5MbOVIZCdHXMFiwRqv5ylVHIfHf8Dz/pvOOox7FRfZrkOzBM8tsrLprMtdp52Oq042gbXJMIExK3cySgvxPVDfbKJB2+NfPnQTLgl68HYxBIHMz4a8G08cqRGcmSG4xYk33xiVG7d8GWT+2GBoRCWkQosqMwOxEWyt0cFAII=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=hcX/w+xXLIcDShFyPiRwjGwYzcdpPdhWqMhMxxqP4tDll5/gYV8mehWvuCubM6M79Mrr4xT+EbDmFCJs6z3Zev4t3VsLORKjDIKGKk+83noKVh+CF2BqRsQYHCNj2PdjCmD4FCh8W3hDNRZzCfRZksc22XamJ07J25c/W0hibEc=
In-reply-to: <0BE974242D712B4B86B49792A69D789C02C37DF8@xxxxxxxxxxxxxxxxxxxxxxxx>
Mailing-list: contact users-help@xxxxxxxxxx; run by ezmlm
References: <6a216ba20710151143q3bdd6289ic3f7fdcff318c8a7@xxxxxxxxxxxxxx> <0BE974242D712B4B86B49792A69D789C02C37DF8@xxxxxxxxxxxxxxxxxxxxxxxx>
I would say that one thing to watch out for with unsigned shorts is byte order.

If the original C code assumed that you can slurp in the entire set
with one read AND the original C code ran on a little-endian machine
(Intel, VAX and a few others) You will need to refactor that code.
Come to think of it, you may have had to deal with that problem
already since I can't think of a direct java replacement for that
idiom.  None the less, something to watch out for.

Another suggestion.  For instances where I transliterated code from C
or COBOL or some other language.  I like to keep the replaced old code
in comments just case I missed some idiomatic interpretation.  Also,
in the case of COBOL, I use the comments to defend my very bad coding
style :)

Having the original code handy is also useful when trying to defend
the identical behaviour of the code.  "What??" you say.  Just over a
year ago, I  was transliterating COBOL to Java for an insurance
company.  I got the Java program to produce identical output.  The
business unit scrutinized the new output more than they did the COBOL
output.  When they found errors in the output, they were shocked that
the COBOL version had the same errors.

-- 
Cheers,
Eric Bardes

<Prev in Thread] Current Thread [Next in Thread>