Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/02/2010 in all areas

  1. My first exposure to references was in OS theory for VMS. A File refernce is something we all use but there is a lot behind the file reference. The folowing may differn in Windows but this is how it went. When we open a file, the OS has to do a lot of work to get it open in our behalf. All of the details about that file are stored in a data struture defined by the OS that tells us where on the disk the file is, if it s open, how it is opened (write protect) etc. These where called a FAB File Atribute Block. Somewhere inside that structure was a pointer to another sturure called a RAB Record Attribute Block that would be used to map physical memory to the proper sectors on the disk. The pointer could take two forms dirrect or indirect. A dirrect pointer held the Virtual address of the first byte/word of of the FAB. An indirect pointer would hold the address where the address of the data structure was located. So as I understand them (just sharing notes) when a pointer (direct or indirect) is used to gain access to a resource (file I/O point, etc) it is commonly refered to as a reference. again, just my 2 cents, Ben
    1 point
  2. Yeah, they are often used interchangably, especially by those of us who don't regularly do low level programming. Since that post I have come to understand what AQ was talking about. My confusion was based on mixing grammar. I used "pointer" and "reference" as adjectives, calling anything that points to something else a pointer, and anything that "refers to" something else a reference. "Points to" and "refers to" are mostly synonomous (afaik) in programming, so it follows that "pointer" and "reference" are synonomous. AQ was using "pointer" as a noun, and it has a more concrete meaning in programming than what I was using. Some of the subtle differences between them are: *All pointers are references. Not all references are pointers. *A pointer is a data structure that contains a memory address. They generally allow much lower level control over the contents of memory. For example, pointer arithmatic can be used to access memory registers near the one the pointer actually points to. *A reference is an abstraction that doesn't have any meaning in and of itself. It could be a memory address, it could be a key in lookup table, it could be an array index, etc. Because a reference has no inherent meaning, reference arithmatic is equally meaningless. *References often have additional protections built into them that aren't available to pointers, such as reference counting to prevent the memory from being deallocated or semaphores to lock a value during read-modify-write operations. So when AQ said, "We fully support references. We do not support pointers at all." I now know what he meant. My initial post used incorrect terminology.
    1 point
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.