File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

C vs Java

 
Venu Chakravorty
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the things that can be done in C and not in Java. Let's keep aside JNI.

Thanks and regards,
venu
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends on the Java implementation.
 
Rob Spoor
Sheriff
Pie
Posts: 20369
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pointer arithmetic. Returning multiple values from a method (through pointer variables). Creating objects (actually structs) on the stack instead of on the heap. Manually cleaning up memory*. Communicating directly with the OS and hardware platform.


* my onetime real-time Java project could really have used this. With little strain it ran for a few minutes, then crashed with an OutOfMemoryError because the garbage collection could not run.
 
Gert Jan Kruizinga
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, pointer math (or magic) is what i miss the most.
 
Henry Wong
author
Marshal
Pie
Posts: 20828
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gert Jan Kruizinga wrote:Yes, pointer math (or magic) is what i miss the most.


I used to miss it (in Java), but not anymore... In fact, I am more used to not using it, that I try not to do pointer arithmetic, even when I am working in C / C++.

Henry
 
Rob Spoor
Sheriff
Pie
Posts: 20369
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh come on... you must miss writing neat little functions like this:
You just gotta love that!
 
Pat Farrell
Rancher
Posts: 4660
5
Linux Mac OS X VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:You just gotta love that!


Nope, I never loved that, even when I was writing PDP-11 assembler code. Note the PDP-11 and later Vax has single hardware instructions to implement the critical construct.

Using null delimited strings has been a huge source of evil bugs over the decades. And of course, it fails totally with non-ASCII data. The world is bigger than just the folks who speak English.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I miss it, although I still do enough embedded work that I don't have to miss it for very long :) What I *really* miss is making dynamic, extensible language implementations in resource-constrained systems a la Piumarta-style stuff, which makes use of pointer arithmetic. Quite enjoyable.
 
Gert Jan Kruizinga
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Rob Prime, that is what i miss, and it starts getting interesting if *dest points to the i/o space of an device.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving thread as not a "beginning Java" question.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's even more fun using FORTH the way I do it where I have to do pointer arithmetic directly on the stack!
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everything is more fun in Forth :)

If there's one language I truly miss working with, it's Forth, although I may take up Factor again. On an only vaguely-related note, I did get to work with actual PostScript for awhile when working at a high-speed printer manufacturer. In addition to the language, we also had really fast cameras to take pictures of how paper moved through the printer--before then I had never really given such thing any thought: paper physics. Crazy stuff.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Everything is more fun in Forth . . .
Even the segmentation errors when you can't see where they happened.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic