Skip to content

Workbranch#1

Open
SPetrenko17 wants to merge 89 commits into
masterfrom
workbranch
Open

Workbranch#1
SPetrenko17 wants to merge 89 commits into
masterfrom
workbranch

Conversation

@SPetrenko17

Copy link
Copy Markdown
Owner

Не смог разобраться с ошибкой. При компиляции библиотеки выдает sigfault.

Comment thread .travis.yml
language: c

os:
- osx

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.

все изменения должны были быть отображены в Pull Request
сейчас это не так

Comment thread .travis.yml
- gcc -std=c11 --coverage -c *.c
#- gcc -o Homework2 *.o -fprofile-arcs -ftest-coverage -g -L. -ldyn -lstat -lpthread -Wl,-rpath,.
#- ./Homework2
- lcov -t "coverage" -o coverage.info -c -d .

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.

в Merge Request не приведены сведения по покрытию кода тестами

Comment thread CMakeLists.txt

add_executable(Homework2 main.c dynamic_library/dyn_lib.c dynamic_library/dyn_lib.h static_library/stat_lib.c static_library/stat_lib.h) No newline at end of file
find_package (Threads)
add_executable(Homework2 main.c libdyn.c libdyn.h libstat.c libstat.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.

интерфейс обеих библиотек должен быть одинаковым
поскольку подключается обе библиотеки, то значит, что ODR правило не нарушается => интерфейс различный

@@ -193,3 +193,41 @@ Linking C executable cmTC_d98ef
Feature record: C_FEATURE:0c_restrict

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.

папки cmake-build-debug быть не должно

Comment thread libdyn.c
#include <stdlib.h>
#include <pthread.h>
#include <zconf.h>
#include "libdyn.h"//NOLINT

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.

почему тут используется NOLINT?

Comment thread main.c
@@ -1,6 +1,52 @@
/*

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.

не приведено условие задачи

Comment thread main.c
int res_mt = mt_run(sequence, size, log_path);
int res_ot = run(sequence, size, log_path);
printf("%s %d %s %d", "test mt:", res_mt, " ot:", res_ot);
assert(res_mt == res_ot && res_mt == answer);

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.

assert работает только в DEBUG-режиме

Comment thread static_library/stat_lib.c
* "Copyright 2019 Sergei Petrenko"
*/

#include "stat_lib.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.

что этот файл здесь делает?

Comment thread main.c
sequence[i++] = c;
if (i == seq_size) {
seq_size = i + len_max;
sequence = realloc(sequence, seq_size);

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.

если realloc упадёт - будет утечка памяти

Comment thread main.c
char *sequence = malloc(len_max);
seq_size = len_max;
printf("\nEnter a string:");
char c = EOF;

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.

EOF умещается в char?
getchar возвращает char?

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