Open
Conversation
okuroshi
reviewed
Jun 1, 2025
| Node* newNode = (Node*)malloc(sizeof(Node)); | ||
| if (newNode == NULL) { | ||
| printf("Memory allocation error!\n"); | ||
| exit(1); // аварийное завершение |
Collaborator
There was a problem hiding this comment.
Не пойму что значит 1. Введи типы ошибок и их условные обозначения.
Enum {
E_MEMORY_1
E_SOMETHING_2
E_SOMETHING_3
}
Что-то на подобие этого и обрабатывай разные виды ошибок. Как минимум с сложном коде по названию будет понятно что за тип ошибки, если не до конца ясно логике в коде
| } | ||
|
|
||
| // Функция добавления элемента в конец списка | ||
| void append(DoublyLinkedList* list, int value) { |
Collaborator
There was a problem hiding this comment.
А если передать указатель, который null ?
| } | ||
|
|
||
| // Функция освобождения памяти | ||
| void freeList(DoublyLinkedList* list) { |
| } | ||
|
|
||
| // Функция вывода списка от начала к концу | ||
| void printForward(const DoublyLinkedList* list){ |
| } | ||
|
|
||
| // Функция вывода списка от конца к началу | ||
| void printBackward(const DoublyLinkedList* list){ |
| #else | ||
| usleep(milliseconds * 1000); | ||
| #endif | ||
| } No newline at end of file |
|
|
||
| void delay_ms(int milliseconds); | ||
|
|
||
| #endif // DELAY_H No newline at end of file |
| pthread_mutex_destroy(&listMutex); // Уничтожение мьютекса | ||
| freeList(&MyList); // освобождение памяти | ||
| return 0; | ||
| } No newline at end of file |
| clean: # Удаление всех .o-файлов и бинарника | ||
| rm -f *.o $(TARGET) | ||
|
|
||
| .PHONY: all clean No newline at end of file |
| void generateRandomList(DoublyLinkedList* list, int count){ | ||
| // Инициализация генератора случайных чисел | ||
| srand(time(NULL)); | ||
| for (int i = 0; i < count; ++i){ |
Collaborator
There was a problem hiding this comment.
такая же проблема с codestyle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Журавлев Максим ИВТ-24