Skip to content

Work branch#1

Open
SPetrenko17 wants to merge 8 commits into
masterfrom
work_branch
Open

Work branch#1
SPetrenko17 wants to merge 8 commits into
masterfrom
work_branch

Conversation

@SPetrenko17

Copy link
Copy Markdown
Owner

No description provided.

@leshiy1295 leshiy1295 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Обнаружен плагиат с работой BoldinDmitry/tech_park_homeworks_c#1
Баллы за обе работы обнуляются

Comment thread .travis.yml
- cppcheck Resource.h
- cpplint main.c
- cpplint Resource.h
- g++ -g -Wall -Wextra main.c -o main

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почему для c программы используется g++?

Comment thread Resource.h
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include-ы стоит располагать в алфавитном порядке

Comment thread Resource.h
char* category;
int count;
};
void resource_init(Resource* resource, char* name, char* callnumber,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

структуру программы стоит делать следующей:

  • интерфейс (прототипы функций)
  • main, который не содержит логики и только вызывает функции ввода/инициализации, обработки и вывода/освобождения ресурсов
  • реализация интерфейса (определение функций)

Comment thread Resource.h
int count;
};
void resource_init(Resource* resource, char* name, char* callnumber,
char* measure, char* category, int count) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

если какие-то параметры не меняются, то нужно это помечать через const

Comment thread Resource.h
resource->count = count;
}

int compare(const void *resource1, const void *resource2) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут void * уже не имел смысла, так как функция работает только для Resource

Comment thread Resource.h
result_comp = strcmp(res2->measure, res1->measure);
if (result_comp == 0) {
return res1->count > res2->count;
} else {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else не нужен

Comment thread Resource.h
} else {
return result_comp;
}
} else {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else не нужен

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants