4 ms·
The fastest way to grok memory issues is to do some work in Assembly. Few programmers will use Assembly for regular work, but the intuition it fosters will serv
by glimcat 14y ago
The fastest way to grok memory issues is to do some work in Assembly. Few programmers will use Assembly for regular work, but the intuition it fosters will serve you everywhere.
- cynwoody 14y agoAbsolutely. First, learn assembly. Pick a machine architecture — it's not that important. For extra credit, pick multiple machine architectures and do something in each. Then learn Lisp.
- heretohelp 14y agoThen learn Forth. And Morse code. You'll need Haskell for dat Damas-Milner sexiness. Wait wait, we need to pile on some Ruby and JavaScript, you don't want to be some sort of weirdo that can't make a web app do you? Hrrrrm. Yep, need some APL. With Unicode. That'll really hammer in the concatenative into your brain.
- malkia 14y agoFor MSVC: cl /FAsc source.c/source.cpp gives you assembly right there from the command line. For gcc: gcc -S For dumping disassembly: DUMPBIN, or LINK /DUMP for MSVC, objdump -d/-D for binutils based (gcc, and others). Debuggers: WinDBG (free), OllyDbg (Windows), gdb/ddd even WinGDB (not free)
- p4bl0 14y agoI think this is a very good advice, but for me it was the other way around: using assembly was easy when I had to because I already grok the pointers from C. I remember in a programming language course we had to write a compiler for a subset of OCaml to MIPS assembly. I had literally no trouble adding support for references, while for others who did not grok C pointers (or had never programmed in C), it was less easy.
- derleth 14y ago> The fastest way to grok memory issues is to do some work in Assembly. And get some footing in OS design. Because, ultimately, your program's entire view of memory is just another API it uses to communicate with the OS.