Thread: Exam question help

  1. #46
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by Overworked_PhD View Post

    There is an old usenet post by Jacob, the author of lcc for Windows, who talks about working a on platform where the pointers don't actually point to a location in memory.
    I think it's rather a stretch to refer to segment:offset as "not actually a location in memory". (And by "rather a stretch" I mean "completely dishonest".) (Unless you've got another post other than the one I know of, in which case you need to cite it.)

  2. #47
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by Overworked_PhD View Post
    Yet you can find the time to act like a total douche on this joint.
    I am not the one acting like a douche. I am trying to help as many people as I can that have questions on this forum. You on the other hand only respond to threads I post in a futile attempt to show that you are more educated than me on the subject, which you are not. Yes, I will counter your stupidity at anytime you try to mislead the people I help with your almost absent C knowledge.
    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. #48
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by tabstop View Post
    I think it's rather a stretch to refer to segment:offset as "not actually a location in memory". (And by "rather a stretch" I mean "completely dishonest".) (Unless you've got another post other than the one I know of, in which case you need to cite it.)
    I think the point is, he is using double* as an abstract representation of an address. Sort of like how ANSI/ISO C uses the term 'object' as an abstract representation of a variable. Most people though just like to think in things they can relate to and not think in terms of an overall general case.

  4. #49
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by Overworked_PhD View Post
    I think the point is, he is using double* as an abstract representation of an address. Sort of like how ANSI/ISO C uses the term 'object' as an abstract representation of a variable. Most people though just like to think in things they can relate to and not think in terms of an overall general case.
    LOL.
    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. #50
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by claudiu View Post
    LOL.
    I don't see anything funny about this. Remeber, C is supposed to be portable. So how does one go about defining the rules for a portable language? By writing in generalized terms.

  6. #51
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by Overworked_PhD View Post
    I don't see anything funny about this. Remeber, C is supposed to be portable. So how does one go about defining the rules for a portable language? By writing in generalized terms.
    No, I was just laughing because what you said showed no understanding of what the person you were quoting actually said. Why don't you run off again and open the C book at the Chapter called : "Pointers" and read the first line there about what a pointer really is.
    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.

  7. #52
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Kernighan and Ritchie Chapter 5: Pointers, Line 1:

    "A pointer is a variable that contains the address of a variable."
    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.

  8. #53
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by claudiu View Post
    Kernighan and Ritchie Chapter 5: Pointers, Line 1:

    "A pointer is a variable that contains the address of a variable."
    This definition has been superceeded by the ANSI/ISO one.

  9. #54
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Eric is speaking in terms of the modern standard you halfwit.

  10. #55
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    First, don't call him Eric. As I said before, he is not your buddy. Secondly, the ANSI standard doesn't define a pointer as a data type not holding an address.

    If indeed it held a VALUE like you claim, please enlighten me, what value does a void* hold?

    I'll wait for you to run back to your daddy to provide an answer.
    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.

  11. #56
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by claudiu View Post
    First, don't call him Eric. As I said before, he is not your buddy. Secondly, the ANSI standard doesn't define a pointer as a data type not holding an address.

    If indeed it held a VALUE like you claim, please enlighten me, what value does a void* hold?

    I'll wait for you to run back to your daddy to provide an answer.
    Huh? Can you please that in proper English. Also, please cite the passages that explicitly state a pointer must hold an address because I don't see it.

  12. #57
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by claudiu View Post
    Kernighan and Ritchie
    You mean the Kernighan and Ritchie???!
    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

  13. #58
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by Overworked_PhD View Post
    Huh? Can you please that in proper English. Also, please cite the passages that explicitly state a pointer must hold an address because I don't see it.
    No, I "can't please that in proper English". Maybe you can.

    Anyway, stop avoiding the question. What type of "value" does a void * point to, according to your interpretation?
    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.

  14. #59
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by MK27 View Post
    You mean the Kernighan and Ritchie???!
    And they wrote this in a book???!
    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

  15. #60
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by MK27 View Post
    And they wrote this in a book???!
    Yes, that's chapter 5 line 1 of the original K&D book.
    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.

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, 12: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