Exam question help

This is a discussion on Exam question help within the C Programming forums, part of the General Programming Boards category; Prove that the offsets are not memory addresses. Prove that you do in fact just use offsets. Prove what the ...

  1. #91
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Prove that the offsets are not memory addresses. Prove that you do in fact just use offsets. Prove what the offsets are offsets of.

    You made a claim, I'm calling you out on it now, like you did earlier. You made the claim, now prove it.


    Quzah.
    Hope is the first step on the road to disappointment.

  2. #92
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by quzah View Post
    Prove that the offsets are not memory addresses. Prove that you do in fact just use offsets. Prove what the offsets are offsets of.

    You made a claim, I'm calling you out on it now, like you did earlier. You made the claim, now prove it.


    Quzah.
    Indeed. To this I would add some extracredit:

    Prove that you are not a troll. This should prove difficult.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  3. #93
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Overworked_PhD View Post
    Yes, because it's totally obvious that both MK27 and whitefang has sided with you.
    No, in fact I provided a bunch of evidence to support your claim that the standard does not simply define a pointer as memory address, if you check post #77.

    Just I don't think it is incompatible with defining a pointer as a memory address either. In reality, all real pointers could both conform to the definition in the standard and contain memory addresses. But the standard's definition is slightly more "conceptual".
    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

  4. #94
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Come on Overworked. Run over to Dr. Whatamaniuk at Kodak to tell us all off.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  5. #95
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by MK27 View Post
    No, in fact I provided a bunch of evidence to support your claim that the standard does not simply define a pointer as memory address, if you check post #77.

    Just I don't think it is incompatible with defining a pointer as a memory address either. In reality, all real pointers could both conform to the definition in the standard and contain memory addresses. But the standard's definition is slightly more "conceptual".
    Yes, but we all know you just threw that in there for the popcorn.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  6. #96
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by MK27 View Post
    No, in fact I provided a bunch of evidence to support your claim that the standard does not simply define a pointer as memory address, if you check post #77.

    Just I don't think it is incompatible with defining a pointer as a memory address either. In reality, all real pointers could both conform to the definition in the standard and contain memory addresses. But the standard's definition is slightly more "conceptual".
    I was being sarcastic. Now, the point is than an address is a concrete example of a pointer. Just like how the velocity of an object at a specific time is a concrete example of the derivative. In both cases, they are specific cases of a more abstract/general concept. To say that in either examples, the specific cases constitute the exact definition, is just plain wrong.
    Last edited by Overworked_PhD; 05-01-2010 at 09:35 PM.

  7. #97
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by claudiu View Post
    Come on Overworked. Run over to Dr. Whatamaniuk at Kodak to tell us all off.
    Which One? There are a few that I communicate with on a regular basis.

  8. #98
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by Overworked_PhD View Post
    Now, the point is than an address is a concrete example of a pointer. Just like how the velocity of an object is a concrete example of the derivative.
    No. It's not quite like that at all.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  9. #99
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Prove that the offsets are not memory addresses. Prove that you do in fact just use offsets. Prove what the offsets are offsets of. Stop skirting around the issue. Prove your claim, or issue the appropriate apologies, and shut the .... up.


    Quzah.
    __________________
    Hope is the first step on the road to disappointment.

  10. #100
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by claudiu View Post
    No. It's not quite like that at all.
    Yes it is. The standard speaks in abstract/general terms. Your problem is that you are thinking in concrete/specific terms. You just have to let go of the fact that a pointer might hold something other than an address.

  11. #101
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by quzah View Post
    Prove that the offsets are not memory addresses. Prove that you do in fact just use offsets. Prove what the offsets are offsets of. Stop skirting around the issue. Prove your claim, or issue the appropriate apologies, and shut the .... up.


    Quzah.
    __________________
    Shut up. You are dumb, annoying, and you probably look like a hooker in pantyhose.

  12. #102
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by Overworked_PhD View Post
    Yes it is. The standard speaks in abstract/general terms. Your problem is that you are thinking in concrete/specific terms. You just have to let go of the fact that a pointer might hold something other than an address.
    Prove it. Give me an example of a pointer in C that doesn't hold an address.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  13. #103
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    This is the same reason why the standard uses the term 'object' instead of 'variable'. This is because a variable is a specific example of an object. However, there are objects, that aren't variables. For example, what gets returned by malloc().
    Last edited by Overworked_PhD; 05-01-2010 at 09:54 PM.

  14. #104
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,758
    Quote Originally Posted by Overworked_PhD View Post
    I was being sarcastic. Now, the point is than an address is a concrete example of a pointer. Just like how the velocity of an object at a specific time is a concrete example of the derivative. In both cases, they are specific cases of a more abstract/general concept. To say that in either examples, the specific cases constitute the exact definition, is just plain wrong.
    You didn't exactly help me understand that when I asked what pointers hold instead of addresses. You just said that they held offsets, which doesn't make any sense, because on my machine I can also store some offset of an array in a pointer, and that pointer will contain an address. So that is inherently confusing. If you wanted to argue that one example was fairer to the general concept in terms of the Standard, then feel free to argue that, but I don't think it's "just plain wrong" to sick to the concrete things in life.

    Every modern computer has memory in terms of cellular arrays that are numbered and these numbers are addresses. (Even though physical addressing is rarely used in anything recent, to allow programs to access additional memory on the hard drive or other device, which is important to systems with low RAM space.)

  15. #105
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by claudiu View Post
    Prove it. Give me an example of a pointer in C that doesn't hold an address.
    MK27 cited the standard. If there was zero possibility of a pointer holding something other than an address, then this would have been stated. But it isn't.

Page 7 of 8 FirstFirst 12345678 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 01:14 PM
  2. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM
  3. sort problem for an exam
    By rjeff1804 in forum C Programming
    Replies: 10
    Last Post: 02-12-2003, 10:33 PM
  4. another exam question
    By rjeff1804 in forum C Programming
    Replies: 4
    Last Post: 02-12-2003, 10:29 PM
  5. The AP Exam.....
    By RoD in forum A Brief History of Cprogramming.com
    Replies: 32
    Last Post: 02-10-2003, 09:46 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21