teaching machines

CS 330 Lecture 21 – Weak Typing in C

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




Today 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 to do a runtime check for the endianness of a processor, how we can check the negativity of a float, and how one might support a limited form of polymorphism for data structures.