-
Couldn't load subscription status.
- Fork 0
Kr2.1 #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Kr2.1 #25
Conversation
| @@ -0,0 +1,48 @@ | |||
| #include <stdlib.h> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Общие замечания:
- Комментарии к коммитам ужасны
- Надо проектные файлы. Тут вообще исходники раскиданы по папкам, собирать вручную — очень такое себе развлечение.
| char *copyString(char const * const string) | ||
| { | ||
| const size_t len = strlen(string); | ||
| char *copy = (char *)malloc(len * sizeof(char)); | ||
| if (copy != NULL) | ||
| { | ||
| strcpy(copy, string); | ||
| } | ||
| return copy; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Есть strdup
| #include <string.h> | ||
| #include <stdio.h> | ||
|
|
||
| char *getString(size_t * const len, FILE * file, char const endOfLine); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надо комментарии к функциям из заголовочного файла
| switch (edge->firstNodeNumber == 0) | ||
| { | ||
| case false: | ||
| { | ||
| edge->firstNodeNumber = nodeNumber; | ||
| break; | ||
| } | ||
|
|
||
| case true: | ||
| { | ||
| edge->secondNodeNumber = nodeNumber; | ||
| break; | ||
| } | ||
|
|
||
| default: | ||
| break; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лол.
| switch (edge->firstNodeNumber == 0) | |
| { | |
| case false: | |
| { | |
| edge->firstNodeNumber = nodeNumber; | |
| break; | |
| } | |
| case true: | |
| { | |
| edge->secondNodeNumber = nodeNumber; | |
| break; | |
| } | |
| default: | |
| break; | |
| } | |
| if (edge->firstNodeNumber == 0) | |
| { | |
| edge->secondNodeNumber = nodeNumber; | |
| } | |
| else | |
| { | |
| edge->firstNodeNumber = nodeNumber; | |
| } |
А то default для булевого выражения выглядит очень мило, особенно с break, который ничего не делает.
| List ** componentsTable = createComponentsTable; | ||
| if (componentsTable == NULL) | ||
| { | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лишняя пустая строчка
| return memoryErrorFile; | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Две пустые строки подряд --- нехорошо
|
|
||
| void printComponentsTable(Graph *graph, const size_t nodeAmount) | ||
| { | ||
| List ** componentsTable = createComponentsTable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это не скомпилится, аргументы не передаются :)
| Graph *createGraph(const size_t nodeAmount, const size_t edgeAmount); | ||
| void connectNode(Graph *graph, size_t index, size_t nodeNumber); | ||
| void printComponentsTable(Graph *graph, const size_t nodeAmount); | ||
| void deleteGraph(Graph * const graph); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше так:
| void deleteGraph(Graph * const graph); | |
| void deleteGraph(Graph ** const graph); |
Чтобы потом иметь возможность присвоить NULL в graph и не оставлять у вызывающего указатель на удалённую область памяти.
| int getValueByIndex(List *list, size_t index, ListErrorCode *listErrorCode); | ||
|
|
||
| //checks if value is already in the list | ||
| const bool checkValue(List *list, int value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не компилится, тут точки с запятой не хватает. Причём тут дело даже не в различиях между компиляторами, так и в gcc, и в Visual Studio, и везде компилироваться не будет
|
|
||
| ListErrorCode append(List *const list, int const value) | ||
| { | ||
| Node **currentNode = list->head; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это тоже вызывает ругань компилятора, list->head имеет тип Node*, а мы его присваиваем в Node **. Типы не сходятся.
No description provided.