Course List: http://www.c-jump.com/bcc/

C++ Memory Access


  1. Computer memory
  2. Computer memory, cont.
  3. Understanding memory is important
  4. Quick look at the disassembly
  5. Memory access by the CPU
  6. Memory access syntax -- machine code
  7. Memory access syntax -- Assembly
  8. Memory access syntax in C
  9. DEC PDP-7 Computer
  10. DEC PDP-7 Computer, cont.
  11. The Multics project
  12. C/C++ memory access
  13. C/C++ memory access, cont.
  14. The asterisk indicates the data type in memory
  15. C/C++ memory access demo v.1
  16. C/C++ history branch
  17. The BCPL language
  18. C/C++ memory access demo v.2
  19. C/C++ memory access demo v.3
  20. Dereference operator
  21. The B programming language
  22. The C programming language
  23. The address-of operator
  24. Pointer is a data type
  25. The C programming language, cont.
  26. Pointer as function parameter
  27. What can we do with pointers?
  28. Why use pointers?
  29. Variables in memory
  30. Memory access summary

1. Computer memory


2. Computer memory, cont.



3. Understanding memory is important



4. Quick look at the disassembly



5. Memory access by the CPU



6. Memory access syntax -- machine code



7. Memory access syntax -- Assembly



8. Memory access syntax in C



9. DEC PDP-7 Computer



10. DEC PDP-7 Computer, cont.



11. The Multics project



12. C/C++ memory access



13. C/C++ memory access, cont.



14. The asterisk indicates the data type in memory



15. C/C++ memory access demo v.1



16. C/C++ history branch



17. The BCPL language


  • Result of portable software research at MIT in 1967

  • Several operating systems were written in BCPL, partially or entirely

  • BCPL Brings us

    • brace symbols { } originally written as
      $( and )$

    • // line comments

    • first ever "Hello, World!" program

    Martin Richards
  • Martin Richards, image courtesy of Martin Richards' homepage at University of Cambridge Computer Laboratory, UK:
    cl.cam.ac.uk/~mr10/


18. C/C++ memory access demo v.2



19. C/C++ memory access demo v.3



20. Dereference operator



21. The B programming language


  • Developed in 1969-70 by Ken Thompson at Bell Labs

  • Did not use data-types: everything was expressed in 18-bit machine words

  • Derives from BCPL

  • B can be thought of as C without types

  • B supports MEMORY[location] notation

  • B also supports *location notation

  • No LINK: B generates assembly, the assembler produces the executable, yielding "a.out"


22. The C programming language


    Ritchie standing and Thompson seated
  • Ritchie standing and Thompson seated working with PDP-11 minicomputer (Wikipedia image)


23. The address-of operator



24. Pointer is a data type


  • 
        double price = 1.52;
        double * location = &price;
        *location = 3.67;
        price = *location;
    
    
  • Dereference operator *location "unlocks" the memory cell:

      pointer dereference


25. The C programming language, cont.


  • Originally, in 1971, pointer declarations were written in the style int ip[];, which enabled most existing B code to continue to work in C.

  • A fossil from this era survives even in modern C/C++ declarations of function arguments (see next slide.)

  • Unix is rewritten in C in 1973 on DEC PDP-11 computer

  • In 1978, Brian Kernighan and Dennis Ritchie wrote "The C Programming Language" book (K&R)


26. Pointer as function parameter



27. What can we do with pointers?



28. Why use pointers?



29. Variables in memory



30. Memory access summary