• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

C vs Java

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Depends on the Java implementation.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, pointer math (or magic) is what i miss the most.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh come on... you must miss writing neat little functions like this:
You just gotta love that!
 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving thread as not a "beginning Java" question.
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic