CS 24000 Study Guide - Midterm Guide: Java Syntax, Bell Labs, Dennis Ritchie

9 views2 pages

For unlimited access to Study Guides, a Grade+ subscription is required.

CS#24000#Lecture#1#Notes-review#1#
!
That#C#language#
C!was!created!by!Dennis!Ritchie!in!1972!in!Bell!Labs!
C!was!used!to!implement!UNIX!
Operating!Systems!used!to!be!implemented!100%!in!assembly!language!
making!them!architecture!dependent!
C!was!designed!to!make!UNIX!portable!
o 95%!of!Unix!is!in!C!
o 5%!is!in!assembly!
Only!the!assembly!language!part!needs!to!be!rewritten!to!migrate!to!other!
machine!
Most!of!the!optimizations!you!can!do!in!assembly!language!you!can!do!them!
in!C!
C!is!a!“High-Level”!assembly!language!
!
Uses#of#C#
Linus!is!written!in!C!
Most!of!the!libraries!(low!level)!that!need!speed!are!written!in!C,!strings,!
Windowing,!Graphic,!MP3!decoders,!math!libraries!are!also!written!in!C!
Java!runs!on!top!of!the!JVM!and!the!JVM!is!written!in!C!
Games!that!need!high!performance!are!written!in!C!(or!C++!in!some!cases!or!
Objective-C)!
Java!syntax!was!based!on!C!and!C++,!therefor,!you!will!fin!that!many!of!the!
elements!in!C!you!knew!them!already!
C++!is!a!superset!of!C,!so!by!learning!C,!you!learn!a!big!chunk!of!C++!
C!is!used!in!Java!native!libraries!that!need!speed:!User!Interface,!Access!to!
Database,!Animation,!Rendering,!Math!Library,!etc!
!
The#C#Principle#
“C!will!not!get!in!your!way!to!make!your!program!run!fast”!
For!example!and!array!access!such!as:!
o a[i]=val
In!Java!the!code!generated!is!equivalent!to!
o //check boundaries
o if (i >= 0 && i<max) { a[i]=val; } else throw out
of boundary exception
In!C!the!code!generated!is!equivalent!to:!
o // no boundary checks!!!!
o a[i]=val;!
o Assignment!will!take!place!in!memory!even!if!i!is!out!of!range.!!
o Assignment!will!happen!beyond!the!end!of!the!array.!!
An!out-of-bounds!is!very!difficult!to!debug!since!the!assignment!may!happen!
in!different!variable!located!in!memory!just!after!the!array.!
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+
$10 USD/m
Billed $120 USD annually
Homework Help
Class Notes
Textbook Notes
40 Verified Answers
Study Guides
1 Booster Class