Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

point out void* comparison to parametric polymorphism

  • Loading branch information...
commit afd82861fc0088a25915e8917c819d384975cffd 1 parent e1a4c80
Stephen Paul Weber authored

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  11-bottom
2  11-bottom
@@ -13,7 +13,7 @@ Each cell is a value and another cell:
13 13
14 14 How should we specify that there is no next cell (like Nil from the Haskell definition)? We can use the special reserved pointer value NULL (which is address 0).
15 15
16   -What is the `void *`? How can we point to nothing? Well, since every pointer value is the same size, the compiler doesn't actually need to know what sort of pointer it is to store the value. A `void *` is a way of telling the compiler "just forget about what sort of data this points at". The developer must remember what sort of data it is, and switch back to a specifically typed pointer before any pointer arithmetic or dereferencing will work.
  16 +What is the `void *`? How can we point to nothing? Well, since every pointer value is the same size, the compiler doesn't actually need to know what sort of pointer it is to store the value. A `void *` is a way of telling the compiler "just forget about what sort of data this points at". The developer must remember what sort of data it is, and switch back to a specifically typed pointer before any pointer arithmetic or dereferencing will work. This is similar to the parametric polymorphism we use in Haskell, in that we can operate on the structure without knowing the type of the values, but when we do want to operate on the values the compiler cannot help us, and we must explicitly state the correct type.
17 17
18 18 #include <stdlib.h>
19 19

0 comments on commit afd8286

Please sign in to comment.
Something went wrong with that request. Please try again.