14

Got told by a senior engineer to basically fuck off with my standard library containers like vector because they are used by people who dont know how to write code in c++ and don't know how to handle pointers.

Am I wrong for trying to use as much possible code from the standard library?

Comments
  • 0
    Yesterday I heard this quote: "Every problem in software engineering can be solved by a layer of abstraction."
  • 3
    @fuck2code but sometimes juniors use a tractor wheel on an bicycle :)
    As always it depends :)
  • 0
    If I recall correctly, latest C++ has no explicit pointers?
  • 0
    @noogli don't think a std lib is a tractor wheel though. unless you use the wrong class from the std lib
  • 0
    @Teabagging4Life
    That was just an April Fool
  • 0
    @StopMotionCuber Damn 😅 haven't bothered to learn C++ yet.
  • 4
    Are you wrong to use stdlib ? : Depends.

    Is using std::vector means you don't know pointers and how to code in c++ ? : Depends, but most of the time no.

    It all depends on the purpose of your code. If we had some concept which is called middle level programming, we would have C++ there. Bad practice but injecting a c++ code into a microcontroller is not impossible.

    If you are developing a module in an embeeded device, you probably should not use vector or hashmap, since it takes more memory. Also using C++99 or higher would not be a great idea, for the sake of backwards compatibility.

    If you develop a simple GUI that is meant to be used in desktop, stdlib is no brainer. You can afford more memory usage and CPU ticks for readability and time, also your sanity.

    Your senior is an ass for behaving like that, but he is not %100 wrong.

    Also, if you use C++11 or higher, consider using std::array instead of std::vector. It is better :)
  • 1
    @illegaldisease thanks that's what I ment but was to lazy to type :))
  • 1
    @illegaldisease
    it is a desktop application and basically I wanted to avoid to use a selfmade array of raw pointers created on the heap for a function that was just called after filling the array. I tried to work on the stack.

    I often feel like I reach out too far.
    I am just curious about improving my skills.
  • 2
    WTF, one of the points of modern C++ is avoiding raw pointers.

    Except of course in embedded where you don't want anything that uses malloc behind the scenes because it will usually fuck up your system.
  • 2
    @tomahawxer Your thought process is right, don't lose your curiosity. You will need it later badly :)

    Stack is always a safer place, always work with stack unless you need your variables need somewhere else entirely, like another class or even a different program. There is no reason for you to use heap if you only need it at class-level scope.

    Heap makes things really easy on bigger projects, but they can always mislead your mind. Use with caution :)
  • 1
    @noogli I am usually super lazy but when it comes to developing, i tend to lose it :D
  • 0
    The standard library is one of the best maintained pieces of code in the world. I've used it in competitive programming and it always offers the best speed during compilation. Std is the reason why so many competitive programmers use c++ in the first place.

    Your "senior" is a moron
Add Comment