#408 closed ожидается проверка (задача сдана)
WW #5
Reported by: | Tarabonda German | Owned by: | Дмитрий Свиридкин |
---|---|---|---|
Component: | WW_c_io | Version: | 2.0 |
Keywords: | Cc: |
Description
Change History (3)
comment:1 Changed 5 years ago by
Owner: | changed from Дмитрий Свиридкин to Tarabonda German |
---|---|
Type: | ожидается проверка → ожидаются исправления |
comment:2 Changed 4 years ago by
Owner: | changed from Tarabonda German to Дмитрий Свиридкин |
---|---|
Type: | ожидаются исправления → ожидается проверка |
Version: | 1.0 → 2.0 |
comment:3 Changed 4 years ago by
Resolution: | → задача сдана |
---|---|
Status: | assigned → closed |
style = (char *)style;
эта строчка ничего не делает
- Файл на запись вы всегда открываете как текствый
- {{{ if (f)
fclose(f); }}} Это, конечно, замечательно, но вы сначала в файл пишете / читаете, а потом уже проверяете, что он открылся.
- число аргументов командной строки надо бы проверять
8/10
Note: See
TracTickets for help on using
tickets.
Как вы компилировали-то? У вас UB из-за отсутствующих предобъявлений. И указатели на функции с разными сигнатурами кастятся. Так делать нельзя.
src/clist.c:22:34: warning: unused parameter ‘list’ [-Wunused-parameter]
gcc -Wall -Wextra -Iinclude -c src/main.c -o obj/main.o
src/main.c: In function ‘my_print’:
src/main.c:7:23: warning: implicit declaration of function ‘get_point’; did you mean ‘add_point’? [-Wimplicit-function-declaration]
src/main.c:7:23: warning: initialization of ‘point_node *’ {aka ‘struct point_node *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
src/main.c: In function ‘my_count’:
src/main.c:11:31: warning: unused parameter ‘node’ [-Wunused-parameter]
src/main.c: In function ‘save_text’:
src/main.c:16:23: warning: initialization of ‘point_node *’ {aka ‘struct point_node *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
src/main.c: In function ‘save_bin’:
src/main.c:21:23: warning: initialization of ‘point_node *’ {aka ‘struct point_node *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
src/main.c: In function ‘main’:
src/main.c:57:22: warning: passing argument 2 of ‘apply’ from incompatible pointer type [-Wincompatible-pointer-types]
In file included from include/point_list.h:4,
include/clist.h:22:41: note: expected ‘void (*)(intrusive_node *, void *)’ {aka ‘void (*)(struct intrusive_node *, void *)’} but argument is of type ‘void (*)(intrusive_node *, FILE *)’ {aka ‘void (*)(struct intrusive_node *, struct _IO_FILE *)’}
src/main.c:65:22: warning: passing argument 2 of ‘apply’ from incompatible pointer type [-Wincompatible-pointer-types]
In file included from include/point_list.h:4,
include/clist.h:22:41: note: expected ‘void (*)(intrusive_node *, void *)’ {aka ‘void (*)(struct intrusive_node *, void *)’} but argument is of type ‘void (*)(intrusive_node *, FILE *)’ {aka ‘void (*)(struct intrusive_node *, struct _IO_FILE *)’}
src/main.c:73:22: warning: passing argument 2 of ‘apply’ from incompatible pointer type [-Wincompatible-pointer-types]
In file included from include/point_list.h:4,
include/clist.h:22:41: note: expected ‘void (*)(intrusive_node *, void *)’ {aka ‘void (*)(struct intrusive_node *, void *)’} but argument is of type ‘void (*)(intrusive_node *, int *)’ {aka ‘void (*)(struct intrusive_node *, int *)’}
src/main.c:78:22: warning: passing argument 2 of ‘apply’ from incompatible pointer type [-Wincompatible-pointer-types]
In file included from include/point_list.h:4,
include/clist.h:22:41: note: expected ‘void (*)(intrusive_node *, void *)’ {aka ‘void (*)(struct intrusive_node *, void *)’} but argument is of type ‘void (*)(intrusive_node *, char *)’ {aka ‘void (*)(struct intrusive_node *, char *)’}
src/main.c:105:22: warning: passing argument 2 of ‘apply’ from incompatible pointer type [-Wincompatible-pointer-types]
In file included from include/point_list.h:4,
include/clist.h:22:41: note: expected ‘void (*)(intrusive_node *, void *)’ {aka ‘void (*)(struct intrusive_node *, void *)’} but argument is of type ‘void (*)(intrusive_node *, FILE *)’ {aka ‘void (*)(struct intrusive_node *, struct _IO_FILE *)’}
src/main.c:113:22: warning: passing argument 2 of ‘apply’ from incompatible pointer type [-Wincompatible-pointer-types]
In file included from include/point_list.h:4,
include/clist.h:22:41: note: expected ‘void (*)(intrusive_node *, void *)’ {aka ‘void (*)(struct intrusive_node *, void *)’} but argument is of type ‘void (*)(intrusive_node *, FILE *)’ {aka ‘void (*)(struct intrusive_node *, struct _IO_FILE *)’}
src/main.c:121:22: warning: passing argument 2 of ‘apply’ from incompatible pointer type [-Wincompatible-pointer-types]
In file included from include/point_list.h:4,
include/clist.h:22:41: note: expected ‘void (*)(intrusive_node *, void *)’ {aka ‘void (*)(struct intrusive_node *, void *)’} but argument is of type ‘void (*)(intrusive_node *, int *)’ {aka ‘void (*)(struct intrusive_node *, int *)’}
src/main.c:126:22: warning: passing argument 2 of ‘apply’ from incompatible pointer type [-Wincompatible-pointer-types]
In file included from include/point_list.h:4,
include/clist.h:22:41: note: expected ‘void (*)(intrusive_node *, void *)’ {aka ‘void (*)(struct intrusive_node *, void *)’} but argument is of type ‘void (*)(intrusive_node *, char *)’ {aka ‘void (*)(struct intrusive_node *, char *)’}
src/main.c:39:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
В main копипаста в разных ветках if
Чтение из файлов стоит вынести в отдельные функции
6.5/10