moogie
|
 |
«
Posted
2003-11-26 23:54:02 » |
|
hiya,
I have recently created an image compressor. I now want to make a video codec using this compressor.
Do that i need to convert my java code to c... however i have had no luck in my searches on google for a tutorial on how one may go about doing it.
If you know of any resouces please do let me know!
Thanks!
|
Java4k RIP 2014
|
|
|
shawnkendall
|
 |
«
Reply #1 - Posted
2003-11-27 01:09:09 » |
|
just kill me ;-)
|
|
|
|
moogie
|
 |
«
Reply #2 - Posted
2003-11-27 01:40:00 » |
|
just kill me ;-) whats your peferred way  I dont want to convert it, but it looks like the only way i will be able to make a codec usable by virtual dub/ mplayer 
|
Java4k RIP 2014
|
|
|
Games published by our own members! Check 'em out!
|
|
shawnkendall
|
 |
«
Reply #3 - Posted
2003-11-27 02:01:47 » |
|
I dont want to convert it, but it looks like the only way i will be able to make a codec usable by virtual dub/ mplayer  Yeah you have no choice it's true. There are few Java to C++ programs out there.
|
|
|
|
nonnus29
Senior Devvie   
Giving Java a second chance after ludumdare fiasco
|
 |
«
Reply #4 - Posted
2003-11-27 15:11:27 » |
|
I don't see a problem with this. If you know Java and you know C or C++ then simply rewrite your code in the other langauage. I've experienced no problems porting code between Java and C++; the syntax is a little different for your class definitions but the rest is identical - just pass everything by reference in your C++ code. Going the other way can be bit trickier of course....
|
|
|
|
moogie
|
 |
«
Reply #5 - Posted
2003-11-27 19:29:20 » |
|
Ah, see thats the rub... i have only really started programming in c/c++
only today have i read up and tried to implement templates such that i can hopefully use the STL when migrating my lists and sorting from java.
|
Java4k RIP 2014
|
|
|
Jeff
|
 |
«
Reply #6 - Posted
2003-11-27 22:05:26 » |
|
Ah, see thats the rub... i have only really started programming in c/c++ Welcome to hell, kid. Your gonna learn why so many of us old C/C++ programmers have totally switched to Java 
|
|
|
|
swpalmer
|
 |
«
Reply #7 - Posted
2003-11-28 01:20:04 » |
|
just pass everything by reference in your C++ code. Going the other way can be bit trickier of course.... This totally ignores the problems of deleting objects. The algorithm in general is the easy bit to port.. it is the memory management, lack of a 'finally' block, no labelled breaks, etc. that are going make it hell.
|
|
|
|
moogie
|
 |
«
Reply #8 - Posted
2003-11-28 01:35:15 » |
|
This totally ignores the problems of deleting objects. The algorithm in general is the easy bit to port.. it is the memory management, lack of a 'finally' block, no labelled breaks, etc. that are going make it hell.
/me grows more apprehensive  Oh well, i will think of it as a C++ learinging exersize.... of PAIN 
|
Java4k RIP 2014
|
|
|
tortoise
|
 |
«
Reply #9 - Posted
2003-11-28 04:44:08 » |
|
Besides, the automatic tools (like the ones that covert from Pascal to C) produce code that is so horrendously bad you have to go in and manually clean it up anyway. Manually porting the code will create code that's clean and maintainable.
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Captain-Goatse
Junior Devvie  
I suck at teh 2D. XBOX IS BIG LOL!111
|
 |
«
Reply #10 - Posted
2003-11-28 11:35:44 » |
|
HAHAHAHAHAHHA Way to go Java mongers!! Java is dumbed down C++. The syntax is almost the same, but C++ has some more advanced features. It should not take long. Prototyping is nice and easy. Once you understand how the program works everything is pretty much the same. And almost as portable. Right now, I'll only use few features of Java in my project. Mainly JavaDoc, because it was the first good documentation method I ever met. Other than that I don't really fiddle with Java, because there are good platform toolkits for C++ and I don't like the complexity java adds when dealing with opengl extensions. So my point was that don't listen to these fanatics. Start download gcc, fire it up and do it. If you start now you'll be finished by sunday. Also it will make you appreciate the beauty of multiple inheritance and pointers. And my point holds. Java is a lot like C++, except for college kids who think "Oh my, Why can't pointers be like butterflies made out of candy! WHy can't they fly around and why can't you snatch one when you are hungry! Oh noes what is this closed standard language! Yay it is Java!!" 
|
|
|
|
Markus_Persson
|
 |
«
Reply #11 - Posted
2003-11-28 11:52:30 » |
|
Ooh, cool! A troll! =D
*hugs Captain-Goatse*
|
|
|
|
Matzon
|
 |
«
Reply #12 - Posted
2003-11-28 11:54:54 » |
|
Also it will make you appreciate the beauty of multiple inheritance and pointers.  The intricacies of multiple inheritance FAR outweight its beauty! Pointers on the other hand, *can* be used for some nice stuff, though there usage is riddled with problems.
|
|
|
|
kevglass
|
 |
«
Reply #13 - Posted
2003-11-28 12:29:50 » |
|
Every language has its ups and downs. A tool, is a tool, is a tool. And captain-goaste, you're a tool.  Kev
|
|
|
|
Captain-Goatse
Junior Devvie  
I suck at teh 2D. XBOX IS BIG LOL!111
|
 |
«
Reply #14 - Posted
2003-11-28 14:25:36 » |
|
 The intricacies of multiple inheritance FAR outweight its beauty! Pointers on the other hand, *can* be used for some nice stuff, though there usage is riddled with problems. First one down. How come you were the only one to catch this? How about a concrete example? You don't have to use it. I happen to like it. C++ is multi paradigm language. Java is not. Anyway my point is that don't get too patriotic of anything. Don't restrict yourself to Java. Look, the world is full of functional languages like ocaml, lisp and haskell. lol pun lol. I do my AI in lisp abd this is only because of sun's relatively open* stance I've found it impossible to intergrate anything else but javadoc into my project. Sad isn't it? *closed
|
|
|
|
Captain-Goatse
Junior Devvie  
I suck at teh 2D. XBOX IS BIG LOL!111
|
 |
«
Reply #15 - Posted
2003-11-28 14:26:53 » |
|
Every language has its ups and downs. A tool, is a tool, is a tool. And captain-goaste, you're a tool.  Kev Dude, You are making fun of me and I do not know how =( Perhaps C++ dumbed me down 
|
|
|
|
kevglass
|
 |
«
Reply #16 - Posted
2003-11-28 14:38:58 » |
|
Perhaps  I work with it every day and its not had that effect on me (at least I hope not)... Sorry.. it was childish.. my apologies. Kev
|
|
|
|
Preston
|
 |
«
Reply #17 - Posted
2003-11-28 16:34:56 » |
|
Anyway my point is that don't get too patriotic of anything. Don't restrict yourself to Java. Look, the world is full of functional languages like ocaml, lisp and haskell. lol pun lol.
.. and (GNU) AWK. Lovely language and by one of the two C inventors (Kernighan). Still, "patriotic" is the wrong word. It's more: bring home. Java is like the big brother of C++. I'd say Java is the natural step to a higher and much more efficent level. Like the step from Assembler to C/C++ has been (Assembler has been fun, but thanks, not again. :-) Back to topic: I've read somewhere there are some (?) tools which allow your Java source to be "brought" to a system level like for example a Win32 system services dll. Unfortunately I don't remember the details, but you didn't need to convert your Java source to C++ or such, but compile your Java source to the final destination. Maybe it's been in the context of some IBM DB2 iterations? Don't remember... :-|
|
|
|
|
moogie
|
 |
«
Reply #18 - Posted
2003-11-28 19:39:40 » |
|
I believe Excelsior Jet can compile java code to a native dll. However that is not the path i really should take, i need to make c code which will be maintainable.
Thanks anyway!
|
Java4k RIP 2014
|
|
|
cfmdobbie
Senior Devvie    Medals: 1
Who, me?
|
 |
«
Reply #19 - Posted
2003-11-28 21:17:37 » |
|
Now there's an oxymoron!  Seriously, the best of luck to you. I don't like having to dip into C/C++ land for anything these days, and was recently rather pleased to discover that a hardware dongle I have to interface with came with a little Java library to take care of the JNI hooks for me. Nice! Naturally it's really very ugly Java, as it is (quite literally) Java as written by C coders.
|
Hellomynameis Charlie Dobbie.
|
|
|
Jeff
|
 |
«
Reply #20 - Posted
2003-11-29 01:00:02 » |
|
A lesser known function of JNI is that it wil let you actually launch a VM and make method calls into it from C. But im not sure you want all that overhead for a plug-in, which is why I didn't mention it sooner. JK P.S. I did 15 years of C and 10 years of C++ guys. Yes, when you NEED "the world's highest level assembler" C is useful. The rest of the time its a royal fricking pain in the ass. i get working code written about 8 times faster in Java then I do in C 
|
|
|
|
Jeff
|
 |
«
Reply #21 - Posted
2003-11-29 01:35:33 » |
|
HAHAHAHAHAHHA
Way to go Java mongers!!
Java is dumbed down C++. The syntax is almost the same, but C++ has some more advanced features.
<snipo>
Other than that I don't really fiddle with Java, because there are good platform toolkits for C++ and I don't like the complexity java adds when dealing with opengl extensions.
So my point was that don't listen to these fanatics. Yeah! Listen to the guy who only does C/C++ as oppsoed to those of us with lots of experience in both. That makes sense. Why are you even here CG? I can't imagine these forums are of ANY use to you. Fact of the matter is that those who have really learned Java after being very skilled C and C++ professionals have time after time reported 2 to 10 times productivity increases. there are plenty of enterprise studies out there to supprot this if you wan't to actually do some google research. FACT: Java promotes error that are late-errors in C and C++ (hiding til release) to compile time or first-run time errors. This alone drastically reduces the error count released into the field and the Q&A time necessary to get to those releases. FACT: C++ suffers from the "fragile abse class" problem due to pre-compilation. Java late binding solves this. FACT: C++ requires you to do your own memory management and is generally horendously slow at allcoation and deallocation compared to Java. The result is pressure to write less object oriented and thus in the end less maintainable code. There are other reasons but these are three of the big ones. Take it from someone who was considered a C++ guru, who now does Java exclusively.
|
|
|
|
Captain-Goatse
Junior Devvie  
I suck at teh 2D. XBOX IS BIG LOL!111
|
 |
«
Reply #22 - Posted
2003-11-29 07:00:31 » |
|
Yeah! Listen to the guy who only does C/C++ as oppsoed to those of us with lots of experience in both. That makes sense.
Why are you even here CG? I can't imagine these forums are of ANY use to you.
Fact of the matter is that those who have really learned Java after being very skilled C and C++ professionals have time after time reported 2 to 10 times productivity increases. there are plenty of enterprise studies out there to supprot this if you wan't to actually do some google research.
FACT: Java promotes error that are late-errors in C and C++ (hiding til release) to compile time or first-run time errors. This alone drastically reduces the error count released into the field and the Q&A time necessary to get to those releases.
FACT: C++ suffers from the "fragile abse class" problem due to pre-compilation. Java late binding solves this.
FACT: C++ requires you to do your own memory management and is generally horendously slow at allcoation and deallocation compared to Java. The result is pressure to write less object oriented and thus in the end less maintainable code.
There are other reasons but these are three of the big ones.
Take it from someone who was considered a C++ guru, who now does Java exclusively.
Please read my other posts. I do quite a bit of lisp and ocaml. Even more than C++ now that I got my renderer finished and got to move into more interesting things. Also please restraing from sprouting those "facts" as truims. They are not much better than someone saying Java is dumbed down C++. 20% increase in productivity? What is it just me or am I watching the infomercials channel here? Wait am I lazy? No. Your failure to provide "enterprise" studies is supported by the fact that I could not find any either. http://www.zdnet.com.au/builder/program/development/story/0,2000035066,20277550,00.htmis something. Also, please if you find something let the source be something else than sun affiliated site. Java.sun.com affiliates promise to increase my productivity, get me a new boiler tank while I enhance my bust and penis size at the same time!! Java is great. I admit it. I like the fact that you can write it once and run it anywhere. However I don't like the closed design of Java, which makes it almost impossible to incorporate it with my other projects written in other languages. Going using C from java is possible, but using Java from C is impossible. However I can use ocaml and lisp that way.  These forums are plenty of use for me. I don't like to be a closed minded C++er as you seem to make it out.  x1000
|
|
|
|
Captain-Goatse
Junior Devvie  
I suck at teh 2D. XBOX IS BIG LOL!111
|
 |
«
Reply #23 - Posted
2003-11-29 07:02:39 » |
|
A lesser known function of JNI is that it wil let you actually launch a VM and make method calls into it from C. But im not sure you want all that overhead for a plug-in, which is why I didn't mention it sooner. JK P.S. I did 15 years of C and 10 years of C++ guys. Yes, when you NEED "the world's highest level assembler" C is useful. The rest of the time its a royal fricking pain in the ass. i get working code written about 8 times faster in Java then I do in C  Have you actually tried that? I sure have. Yet it is incomplete and unstable and i'd rather claw my eyes out than use it.
|
|
|
|
princec
|
 |
«
Reply #24 - Posted
2003-11-29 15:16:18 » |
|
Worked all right for me. Back on topic: a direct port from Java to C++ is probably not possible. It would be wise to determine the gist of the algorithm and write it from scratch. As someone  here said, you'd have it done by tomorrow if you just sat down and did it. Cas 
|
|
|
|
Jeff
|
 |
«
Reply #25 - Posted
2003-11-29 17:11:19 » |
|
Also please restraing from sprouting those "facts" as truims. They are not much better than someone saying Java is dumbed down C++.
Hmm that sounds familiar...
20% increase in productivity? What is it just me or am I watching the infomercials channel here?
How about some arguments rather then some insults? Your assertions are sorely lacking ANY substantiative argument. I gave you clearly identified and visible REASONS why Java is more productive. You basically just ignored them and launched another barrage of empty insults. And thats 200% to 1000%. Read closer. I sad 2 to 10 TIMES productivity. Wait am I lazy? No. Your failure to provide "enterprise" studies is supported by the fact that I could not find any either.
I wouldn't say lazy, I'd say "google challenged." First search I did (Java Productivity Study), first listing to pop up: http://www.wellscs.com/robert/java/productivity.htmThis a very well researched and well established phenomenon, despite your trolling comments. Yes it is. Its yet ANOTHER productivity point I didn't mention. (I told you tehre were more.) Late binding allows much more freedom and ease of use when trying to create reusable libararies. (Its something I alluded to in "fragile base class" but didn't really go into.) Also, please if you find something let the source be something else than sun affiliated site. Java.sun.com affiliates promise to increase my productivity, get me a new boiler tank while I enhance my bust and penis size at the same time!!
Mature. As I said before, if you find no value here why hang around? Java is great. I admit it. I like the fact that you can write it once and run it anywhere. However I don't like the closed design of Java, which makes it almost impossible to incorporate it with my other projects written in other languages.
Plain wrong, there are over 100 other languages written for the Java VM. If you cannot find the link googling, and I realize you are handy capped in that regard, let me know and I'll find that for you, too. Going using C from java is possible, but using Java from C is impossible.
Wrong and ignorant. Please read the artcle on JNI that comes with the VM. You can launch a VM from C. You can call INTO a VM from C. These forums are plenty of use for me. I don't like to be a closed minded C++er as you seem to make it out.
How? You started this by saying "Right now, I'll only use few features of Java in my project. Mainly JavaDoc, because it was the first good documentation method I ever met. Other than that I don't really fiddle with Java," How then is a site dedicated to Java programming of ANY use to you?? Other then a place to post trolling and ignorant assertions, that is. [/quote]
|
|
|
|
Jeff
|
 |
«
Reply #26 - Posted
2003-11-29 17:22:48 » |
|
Oh and I have to say, dude. That that last quote of yours I quoted was almost unnecessary.
Its obvious to anyone who actually HAS done the Java transition, that you haven't yet or we wouldn't be having this discussion. That 2 to 10 times figure I bandy about is based on hundreds of reports I've heard from hundreds of developers in my speaking and client contact capacities for Sun.
Ya know, not one has told me they were more productive in C/C++. In fact they universally tell me Java has made them MUCH more productive.
Its obvious to anyone who does it, dude. The one's who argue are the ones who don't want to. (cf. Slashdot.)
|
|
|
|
Jeff
|
 |
«
Reply #27 - Posted
2003-11-29 17:26:42 » |
|
Im going to ask Chris to lock this thread because there is clearly nothing more productive that can be said here. The facts are there. You can chose to ignore them. But further trolling isn't going to elicit a response from me.
**plonk**
|
|
|
|
swpalmer
|
 |
«
Reply #28 - Posted
2003-11-29 17:45:08 » |
|
However I don't like the closed design of Java, which makes it almost impossible to incorporate it with my other projects written in other languages.
A truly ignorant statement from someone that obviously hasn't done any research. I love the people that go on an don about Java being "closed" and "proprietary" - just silly. Just because Sun decided not to hand over the future of Java to a standards body that Microsoft can bully (*cough*W3C*cough*). The JCP becomes more "open" every day. I certainly feel as a Java developer I have more of a chance of influencing the direction of Java than say C++ or .Net.
|
|
|
|
|