teaching machines

CS 330 Lecture 19 – Weak Typing in C

March 11, 2016 by . Filed under cs330, lectures, spring 2016.




Let’s start with a Program This:

In pseudo-C code, write down an implementation of itoa, which converts an int (assumed >= 0) into a C string.

From there we’ll look to some examples of weak typing in C, in which we undermine the type system to do some sometimes perfectly reasonable things. We’ll see why arrays traditionally couldn’t be allocated on the stack via consts, how we can check the negativity of a float, and how one might support a limited form of polymorphism for data structures.



/usr/lib/ruby/2.7.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'coderay' (>= 0) among 56 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/.gem/ruby/2.7.0:/var/lib/gems/2.7.0:/usr/lib/ruby/gems/2.7.0:/usr/share/rubygems-integration/2.7.0:/usr/share/rubygems-integration/all:/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0:/home/johnch/.gems', execute `gem env` for more information
	from /usr/lib/ruby/2.7.0/rubygems/dependency.rb:323:in `to_spec'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_gem.rb:62:in `gem'
	from ./coderay:24:in `