| To: | <users@xxxxxxxxxx> |
|---|---|
| Subject: | RE: [cinjug-users] Java vs. C |
| From: | "Hudson, Loren (GE Infra, Aviation, Non-GE, US)" <loren.hudson@xxxxxx> |
| Date: | Mon, 15 Oct 2007 15:04:22 -0400 |
| Delivered-to: | mailing list users@xxxxxxxxxx |
| In-reply-to: | <6a216ba20710151143q3bdd6289ic3f7fdcff318c8a7@xxxxxxxxxxxxxx> |
| Mailing-list: | contact users-help@xxxxxxxxxx; run by ezmlm |
| Thread-index: | AcgPW1SP674UqHxUTNaA6BPpQC1vmgAACPGA |
| Thread-topic: | [cinjug-users] Java vs. C |
|
Ed,
I'm not using JNI. I pretty much start with the C
code, rename it the file to .java, and work from there. I'd say I end
up with about half my Java code and half untouched C code. Most of
the C code is parsing through a very large array of unsigned shorts. Since
the syntax is the same WRT array subscripts, bit-shifting, and bit-masking, I'm
leaving most of that code untouched. I haven't even changed variable names
at this point.
The I/O and variable declarations are really the only
part I have to port. That wraps the (largely) untouched array-parsing
code.
If I'm still worrying about this code a month an a half
from now, I will be very concerned. All told, it's less than 1000 lines of
C code.
To clarify, I was just wondering if there was any C
syntax that compiles perfectly as Java syntax but doesn't do the same
thing. For instance, does C deal with floating point variables in the same
way? I've changed all of the floats in C to doubles in Java. Nothing
goes past the fifth decimal point, so could that be an
issue?
James,
The C code reads in the data as unsigned shorts.
When it has a value that takes up more than two bytes, it concatenates them
together when it outputs them. None of the aggregated data comes from
fields that are more than two bytes.
Josh,
Rounding may well be the culprit. I'll look into
that. Thanks!
Thanks all,
MDW - Military Data Warehouse Java Developer/Solution Architect Sogeti Consultant loren.hudson@xxxxxx From: esumerfd@xxxxxxxxx [mailto:esumerfd@xxxxxxxxx] On Behalf Of Edward Sumerfield Sent: Monday, October 15, 2007 2:43 PM To: users@xxxxxxxxxx Subject: Re: [cinjug-users] Java vs. C You say you are wrapping the C code with java data structures. Does this mean that you are using JNI to call C methods? How much of the C do you have to "port" as opposed to "wrap"? As a language C is as close to assembly as it gets so the biggest issues that you face are memory management. However, if you are not changing any of the original code then I don't see how your totals would be off. The key to these things is writing tests before each change so that after wards you know it failed. Then make changes in small increments so you find out what failed as soon as possible. Certainly easier said that done. My last port was a C++ to java and after a month and a half of trying to understand the original code and duplicate it in java I gave up, through the C++ away and spend the next 2 months with a customer re-writing it. I think this was much faster plus they were able to add features that were not in the original. On 10/15/07, Hudson,
Loren (GE Infra, Aviation, Non-GE, US) <loren.hudson@xxxxxx> wrote:
-- Ed |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [cinjug-users] Java vs. C, josh marotti |
|---|---|
| Next by Date: | Re: [cinjug-users] Java vs. C, Eric Bardes |
| Previous by Thread: | Re: [cinjug-users] Java vs. C, Edward Sumerfield |
| Next by Thread: | Re: [cinjug-users] Java vs. C, Eric Bardes |
| Indexes: | [Date] [Thread] [Top] [All Lists] |