Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Return value of memory allocation ?

  1. #11
    Senior Member
    Join Date
    Jul 2001
    Posts
    280

    Re: Return value of memory allocation ?

    So there is no difference between these two lines:
    Code:
    myclass->mymethod();
    (*myclass).mymethod();
    ...other than preference or readability. *There is no technical reason I should use one over the other.

    And I can treat this
    Code:
    ...
    int *ptr;
    ...
    ptr= new int[size];
    ...
    ...just like any other normal array.

    Sorry about belaboring the point. *I just want to make sure I have this correct.

  2. #12
    Guest

    Re: Return value of memory allocation ?

    So there is no difference between these two lines:
    Code:
    myclass->mymethod();
    (*myclass).mymethod();
    ...other than preference or readability. There is no technical reason I should use one over the other.
    Yes, there's no difference at all, but the first one is preferred as there's less typing, but you can't do pointer arithmetic with the first one.

    And I can treat this
    Code:
    ...
    int *ptr;
    ...
    ptr= new int[size];
    ...
    ...just like any other normal array.

    Sorry about belaboring the point. I just want to make sure I have this correct.
    Yep, you got it. Pointers can also be accessed as arrays.

Similar Threads

  1. Firewall script in RHEL 4
    By sud.tech in forum Programming
    Replies: 8
    Last Post: 06-12-2008, 01:07 PM
  2. Cannot start X again ....
    By DjiT in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 02-23-2005, 11:51 PM
  3. Random Access Memory (RAM) Guide
    By Waka-Gashira in forum Windows - General Topics
    Replies: 2
    Last Post: 01-05-2005, 10:47 PM
  4. Memory????
    By comtux in forum Linux - General Topics
    Replies: 10
    Last Post: 09-25-2004, 12:41 AM
  5. Memory errors with XP Pro
    By in forum Windows - General Topics
    Replies: 18
    Last Post: 04-15-2004, 10:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •