Java notes

Wendell Murray Associates Inc.

C, C++ and JNI notes

Homepage

C

The main book that I have been using to increase my knowledge of C is The C Programming Language by Brian Kernighan and Dennis Ritchie.

It is based on ANSI C. Kernighan and Ritchie themselves are key figures in the creation and development of the language and were also key members of the group at Bell Laboratories which created UNIX among other activities and accomplishments.

Another excellent, short text on C is the GNU C reference manual available here. I have used and still use the text

Two other good books on C are The C Primer by Hancock and Krieger, McGraw-Hill, from 1986 and C Programming by Mike McGrath in the very good series on programming called in easy steps published by Barnes & Noble.

One of the more intriguing and somewhat difficult features of C is pointer. There are two operators used with pointers: * and &. The first is overloaded from its use as the symbol for multiplication. It is used to declare a pointer variable for a given object type, e.g. for an integer. It is also overloaded to serve as the "dereferencing" operator to obtain the value at the location in memory pointed to by the pointer. The & operator returns the value of the pointer, which is the memory address where the type is stored.

I provide an example regarding the use of these operators in the examples section here.

C++

Regarding C++, I have been using two books and will start carefully reading a third shortly.

The first is Navigating C++ and Object-Oriented Design by Anderson and Anderson.

The second is C++ Inside & Out by Bruce Eckel.

The third book, which I have only skimmed through so far is The C++ Programming Language by Bjarne Stroustrup, who is the creator of the language and was another researcher at the famous Bell Laboratories where many seminal developments in computer science and engineering originated.

The first two are good. It is helpful to have more than one text to follow, particularly with a language such as C++ which is significantly more complicated than C or than Java, for that matter.

JNI

Regarding JNI, I have used 2 books, both very good:

It takes some thought and working through these books to understand the concepts and the requirements of JNI. The Java and C languages are both working on the same memory and through the same CPU or CPUs, but each language needs to be able to communicate its data types and its methods/functions to the other language. JNI has to provide the software constructs to do that.

These constructs, including the generation of the header file to translate the Java code into code that provides environmental objects that the C code can use, appears strange at first, but makes sense once one spends sufficient time reviewing and writing one's own code.