Thread: What imperfections of the code?

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    1

    Question What imperfections of the code?

    What imperfections of the code?

    Code:
    void MyClass(int a) 
    {
        int *x = new int[a];
        int *y = new int[a];  
        Bar(x, y);    
        delete [] x;
        delete [] y;
    }
    Thanks!

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    I don't know. Why should there be something wrong with it?

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    What imperfections of the code?

    Code:

    void MyClass(int a)
    {
    int *x = new int[a];
    int *y = new int[a];
    Bar(x, y);
    delete [] x;
    delete [] y;
    }

    Thanks!
    Smells like homework. Think "exceptions".

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    There is also a question of how descriptive the code is of what it does. What is x, y, .... ?
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  5. #5
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    A function named 'MyClass'.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  6. #6
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by Mario F. View Post
    A function named 'MyClass'.
    I'm sorry, but I have to post my LOL at that..

    Edit: I'm not disagreeing, I thought your observation was funny and how bluntly you put it. Good observation.
    Last edited by Dae; 09-12-2009 at 08:15 AM.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  7. #7
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Well, that's all we are allowed to see. A function.
    Last edited by Mario F.; 09-12-2009 at 07:52 AM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM