4

Data members I don't see the point of the T** ptrToPtr member variable. Every instance of *ptrToPtr can be replaced by ptr. Remove that member and you have one less thing to delete. Why is refCount a pointer to a long? If you make is just a long then you don't need to delete it. I see what's happening. Every instance that has the same pointer needs to have ...


4

You can import and use datetime rather than validating date yourself. >>> import datetime >>> datetime.date(2020, 9, 9) datetime.date(2020, 9, 9) >>> datetime.date(1990, 2, 29) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: day is out of range for month As such we can ...


3

Reading into the question somewhat, there is emphasis on not only matching to a date pattern where the digits and separators are in the right places, such as 98/76/5432 which your pattern would accept; but to narrow this - with the pattern itself - knowing what digits are allowable in which positions. One basic improvement is to constrain the range of the ...


2

Much of this feedback overlaps with that of @JakobLovern who has already covered some great points; nevertheless: You should break up main into subroutines You can avoid play being needed if you have a subroutine that returns a boolean Avoid aggressive abbreviation of your local variable names Consider adding an input validation loop Move your 'Goodbye' to ...


2

Code Review Don't see the point in this member: T** ptrToPtr; rCPtr() { try { ptr = new T; Calling new to create a new T is not appropriate here (having an empty object is perfectly fine). As the user may turn around and set a new pointer to own. As a result you don't need a try catch block on this one. don't mind ...


2

Answers to your questions Should the main be broken into more functions? Yes. Keep it as high level as possible. Basically, it should look like: int main() { char sentence[...]; while (fgets(sentence, sizeof sentence, stdin) != NULL) { processSentence(sentence); } } Where processSentence() would do everything necessary to process a single ...


1

Use consistent indentation I don't know if the indentation style of the code you pasted here is as you wrote it, but if it looks the same in your code editor, you should definitely try to fix it and make it more consistent. I would not bother trying to fix this manually, instead use either code formatting functions of your editor, or use an external tool ...


1

V already has a built-in enumeration for plain arrays: for i, a in arr { } Which removes six unnecessary lines of code. List comprehension would remove another dozen lines, and what little I understand about V's map/reduce, it seems very limited (think lambda without closure) so that is not an option. Python's list comprehension with zip is an efficient way ...


Only top voted, non community-wiki answers of a minimum length are eligible