9POINTER DATA TYPES

image

Pointers are the data type equivalent of a goto statement. Used carelessly, they can turn a robust and efficient program into a buggy and inefficient junk pile. Unlike goto statements, however, pointers can be difficult to avoid in many common programming languages. There are no “pointers considered harmful” papers in academic journals like Dijkstra’s “Go To Statement Considered Harmful” letter.1 Many languages, like Java and Swift, attempt to restrict pointers, but several popular languages still use them, so great programmers need to be able to deal with them. To that end, this chapter will discuss:

  • The memory representation ...

Get Write Great Code, Volume 2, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.