Hi There. This is my fist post. I'm an aspiring programmer looking for a position as a C++ programmer. I am currently an iOS developer as well as having experience with C# in Unity, but my C++ is not as strong as my skill with these other languages. I recently applied to a company for a mid level C++ programmer. I don't want to disclose the name because they asked my not to share the test publicly. The test they sent me was pretty complex and definitely more advanced than I expected so I did not get the position. I would really like to know what I did wrong, what I did right, and what I could of done better so I can learn from the experience and hopefully improve myself. The test was to complete a container class they has which was like a memory pool. I was passed in a char * and that was the only memory I could use. I thought I had it going in the right direction, but I definitely did not get it right because it would crash when I ran it and like I said, it was more advanced than I was used to.
Iwas wondering if there were any C++ experts that wouldn't mind taking 5 or 10 minutes looking at my class and letting me know where I went wrong. I would really appreciate it and I really think if I could have my errors explained it would help to visualize why I did it wrong. The class is not too big, only about 200 lines.
If any body is willing to help a fellow programmer out I would be very greatfull. I don't want to post any code here because I agreed that I wouldn't publicly share it, but if you are willing to help I will PM you the file.
Thanks so much for anybody willing to take a look. You're really helping me out and helping me learn.
The company didn't give you any feedback regarding the test? I don't consider myself an expert but I can take a look at it, and try to give you some feedback tonight. But, honestly you will get better responses if you post it here. I do understand your reluctance to post it.
Two things I noticed glancing through it, in the ctor you only shallow copy the buffer pointer, and you dont delete anything in the dtor. I'll try to look at it more in depth when I have some time.
Edit: operator in a linked list?
Did you test the class? With template classes, you have to test each function as templates functions only compile as needed. NULL and assert are undefined, you need to include the correct headers. Also Add() crashes since you dont allocate any memory for the data you return.
For example if T is char then one element occupies 12 bytes on 32-bit system. I do not think that elements should be placed in a list. Only empty slots of the buffer could be placed in a single-linked list. If the addres of element is fixed it is easy to remove it.i You need not search it in the list of elements.
Also it seems that you do not know about mem-initializers for constructors.
I thinlk that it is the container that shall bother about freeing the buffer.