Thread: learning about memory relevant to programming

  1. #1
    Registered User
    Join Date
    Jan 2017
    Posts
    1

    Question learning about memory relevant to programming

    Hello there,

    I'm starting to program in C and am interested on learning about how memory is used and memory management as these topics seem relevant to C programming. Also wanted to learn about use of memory addresses and pointers.

    what online resources resources could you recommend to learn more about these topics?

    And also what other topics are relevant and should be researched ?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,489
    > what online resources resources could you recommend to learn more about these topics?
    Google perhaps?
    memory manangement in c - Google Search

    > And also what other topics are relevant and should be researched ?
    There are many aspects to software in general that have nothing to do with knowing where the curly braces go.

    Once you get past the student homework phase (single programmer, a few requirements, a few hours work, a single source file), you need some level of skill in say
    software development life cycle - Google Search
    You will need to know a few things about requirements, design, code, test, release and some of the ways people use to get from "I want a foo" to "Here is your foo".

    As soon as you start working in a team, you need to know about version control software -> Version control - Wikipedia
    At a minimum, you should know about the concepts check out, check in, branch and merge.

    A lot of people will look at your code, so presentation is key -> Indent style - Wikipedia
    If you're writing your own code, pick a style and stick to it. If you're updating someone else's code, then use the same style they used (even if you hate it).

    Similarly, a lot of people will likely review your code (and send you comments), and make further changes to your code.


    Be familiar with the various revisions of the C language -> https://en.wikipedia.org/wiki/ANSI_C
    C89 and C99 are the most common. C11 is the latest standard, but there won't be a lot of existing software depending on a C11 compiler.

    Be familiar with several different compilers -> https://en.wikipedia.org/wiki/List_o...rs#C_compilers
    GCC and Clang are very good, Visual C++ (in C mode) if you're on Windows.
    Always compile at the maximum warning level, and make sure you understand the solution to each diagnostic, as opposed to some hack just to silence the compiler.

    Different compilers spot different issues, and produce different executable code. If your code has hidden system dependencies, then compiling on different compilers will often expose those differences. So if your code compiles cleanly and produces the same answer across several compilers and platforms, then it's likely to be very good code.

    Know the hierarchy of your APIs and organise your code accordingly (don't start off writing a BBoM).
    ISO - eg strcpy, strcat, printf
    POSIX - eg opendir, chmod
    3rd Party - eg TIFFOpen, part of libtiff
    Organise your code so the more specialised the API is, the tighter it is encapsulated within your overall project.
    3rd party API's change the most often, and support across various compilers and operating systems varies widely. If you need to upgrade or work around an API, it's best if it isn't spread all through your code base.

    Find a project which interests you:
    - download the code and study it intensely.
    - download and read any other supporting documentation.
    - subscribe and listen to the talk on the various mailing lists; figure out who the maintainers and main contributors are, and whether they seem fair minded enough for you to work with.
    - study the submit / test / release process of the project.
    - study the bug database for the project.
    - at some point, introduce yourself.
    - pick a bug with a clear (and reproducible) fault and try to fix it (or ask the maintainer for an easy to start with bug).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Learning C Programming
    By Manakore in forum C Programming
    Replies: 5
    Last Post: 02-08-2011, 05:32 PM
  2. Memory Functions - Still Learning
    By Alexander in forum C Programming
    Replies: 52
    Last Post: 09-27-2008, 01:57 AM
  3. Are C and C++ still relevant?
    By CompiledMonkey in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 12-24-2007, 04:29 PM
  4. Learning Memory, Ins and Outs?
    By Zoiked in forum C Programming
    Replies: 1
    Last Post: 08-27-2007, 04:43 PM
  5. Is C still relevant....
    By craigbalsillie in forum C Programming
    Replies: 31
    Last Post: 08-20-2002, 12:18 PM

Tags for this Thread