Slashdot Mirror


User: bunbunbun3

bunbunbun3's activity in the archive.

Stories
0
Comments
2
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 2

  1. C++ = unsigned long lookatme = 640000000; on Ask Slashdot: It's 2014 -- Which New Technologies Should I Learn? · · Score: 1
    Surely it should be javascript:

    var lookatme = 640000000;

    c++

    auto lookatme = 640000000;

  2. good c++ programmers avoid new on Practical C++ · · Score: 2, Informative
    new (and delete) should really be rarely used in modern C++ programming. Use smart pointers instead.

    The standard has autoptr. Boost (www.boost.org) has loads more useful variants. 99% of the time, heap memory (i.e. allocated via new) instead of stack memory (automatic variables) is only used so that you can allocate variable amounts of memory. By using smart pointers, you can have the flexibility of new as well as the safety of automatic variables (they deallocate out of scope).

    When used as class member variables, smart pointers provide clear ownership of resources, helping programme design.

    new and delete are also classically used to manage buffers. This should be done entirely with strings, vectors and deques nowadays.

    For modern c++ programmes, run of the mill memory errors are really inexcusable, just as they are in Perl (my other favourite language). I am a full time programmer and have not had a memory/buffer error in years (yes, I have written countless kLOC and, yes, my programs have all sorts of other bugs ;-] )