Thread: "Pointers" <-- crappy name

  1. #61
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by Elysia View Post
    On any modern operating system, that is impossible.
    But it is possible to overwrite other sensitive data by writing out of bounds (it might even have corrupted a buffer that holds contents to write to the disk in an open file).
    It was quite a long time ago
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  2. #62
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by ಠ_ಠ View Post
    It was quite a long time ago
    Recently, my mom sprayed one of those disinfectant/air freshener things on her new Mac laptop keyboard while it was running. Ha ha ha ha....
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #63
    Registered User MacNilly's Avatar
    Join Date
    Oct 2005
    Location
    CA, USA
    Posts
    466
    I can see that people here have different opinions of what exactly a pointer is, even though at the same time I assume they are able to use them properly.

    Maybe one could clear up confusion by learning some basic assembly language, where you learn how "pointers" truly work. I quoted pointer, because pointer can refer to the abstract idea (ie, reference variable) or to the physical operations that take place to implement that idea.

    At the bit level, then, a 32-bit "integer" differs not at all from a 32-bit "pointer." It's just a finite series of bits. The difference is in how the CPU will interpret that "number." We, the programmers, tell the CPU how to do that by specifying different opcodes.

    One opcode says "store the bits at some memory location at some other memory location" (x = y in C) and another says "go to this memory address and interpret the bits at that memory address as another memory address and copy those to some other memory location" (x = *y in C)

    Now, you all may or may not have known that already, but I think it covers the basics of pointers. Now one just has to learn the C syntax behind it all.
    Last edited by MacNilly; 06-24-2009 at 01:42 PM.

  4. #64
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Quote Originally Posted by CornedBee View Post
    string is an array.

    Now, C has the distinction between "lvalue" and "rvalue". These are muddled concepts, but succinctly put, the lvalue of a variable is the variable itself (think of it as a "location value"), while the rvalue is its value. Temporaries and literals don't have lvalues (except string literals). You cannot take the address of an rvalue. You cannot use an lvalue in most other operations, such as arithmetic.
    C99's compound literals are lvalues and you can take the address of them. For example:
    Code:
    int *ip = &(int){ 5 };

  5. #65
    Registered User
    Join Date
    Apr 2009
    Posts
    41
    Quote Originally Posted by argv View Post
    "pointers" when they are more like "maps".
    A map is more like an array of pointers than just a pointer. You still need another pointer to use a map say like "1600 Pennsylvania Avenue NW in Washington, D.C.". That address isn't the pointer but this post now becomes a pointer to a place on the map that points to a place on the planet.

    I prefer to think of it like the sign on the bathroom door. You wouldn't ........ on the sign would you? It's saying that a toilet is inside. Pointers are just really common knowledge. We follow road signs, elevator buttons, and just all sorts of things every day.

    IMO your tutorial has just confused more people who already knew what a pointer was, but just didn't know how to use them in programming.

    Just cause someone says something is hard doesn't mean it's hard. Pointer IMO are just to hyped up and that has caused more confusion than was nessacary.
    Last edited by strickyc; 06-25-2009 at 08:22 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Look at my crappy program. Look at it!
    By Hirumaru in forum C Programming
    Replies: 18
    Last Post: 03-12-2009, 01:17 AM
  2. <( ' '<) Simple Programming Question?
    By strigen in forum C Programming
    Replies: 1
    Last Post: 03-05-2009, 03:17 PM
  3. x = x < y < 2; WHY IS THIS ALWAYS TRUE!?
    By sh4k3 in forum C Programming
    Replies: 5
    Last Post: 06-08-2007, 01:00 AM
  4. > > > Urgent Help < < <
    By CodeCypher in forum C Programming
    Replies: 2
    Last Post: 01-31-2006, 02:06 PM