Closed GoogleCodeExporter closed 9 years ago
1. Каким компилятором Вы пользуетесь? У меня
при сборке ругается на count, т.к. в std есть
одноименная функция.
2. Глобальные переменные - очень плохой
стиль программирования. Как минимум это
усложняет программу. Как максимум, это
делает Вашу функцию неприменимой в
многопоточном окружении (т.е. двум потокам
нельзя вызывать одновременно эту функцию,
т.к. оба экземпляра функции будут делить
одну и ту же глобальную переменную).
Исправьте.
3. Варнинги следует исправлять:
main.cpp: In function ‘char** split(const char*, const char*)’:
main.cpp:15: warning: comparison between signed and unsigned integer expressions
main.cpp:21: warning: comparison between signed and unsigned integer expressions
main.cpp:24: warning: comparison between signed and unsigned integer expressions
main.cpp:50: warning: comparison between signed and unsigned integer expressions
4. Подаю на вход:
qwe123asd123
123
Получаю:
qwe
asd
23
Решение не принято.
Original comment by aivyu...@gmail.com
on 11 Nov 2012 at 4:09
Original comment by kirillr...@gmail.com
on 11 Nov 2012 at 5:05
1. Снова варнинги:
main.cpp: In function ‘char** split(const char*, const char*)’:
main.cpp:52:113: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
2. Подаю на вход:
qwe123asd
123
Получаю:
qwe
ad
Решение не принято. Кирилл, Вы вообще как-то
проверяете решение, прежде чем сдавать?
Original comment by aivyu...@gmail.com
on 25 Nov 2012 at 11:00
Original comment by kirillr...@gmail.com
on 12 Dec 2012 at 6:48
Подаю на вход те же данные. Получаю:
qwe123asd
123
qwe
asd
x(1450) malloc: *** error for object 0x7fe6f8c000e0: pointer being freed was
not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
Т.е. ответ на этот тест верный, но где-то
проезд по памяти.
Остальные тесты тоже проходит.
Решение не принято.
Original comment by aivyu...@gmail.com
on 17 Dec 2012 at 6:27
Original comment by kirillr...@gmail.com
on 21 Dec 2012 at 12:58
Совмещать использование malloc/free и new/delete - не
очень хорошая практика.
Решение принято.
Минус балл за сдачу не в срок.
Original comment by aivyu...@gmail.com
on 22 Dec 2012 at 10:17
Original issue reported on code.google.com by
jiraff...@gmail.com
on 6 Nov 2012 at 7:34