Skip to content

Conversation

@kamendov-maxim
Copy link
Owner

No description provided.

}
}

return (state == start ? false: true);

Choose a reason for hiding this comment

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

Suggested change
return (state == start ? false: true);
return state != start;

А то как будто != возвращает не булевое значение

memoryError
} ExitCode;

ExitCode main(void)

Choose a reason for hiding this comment

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

Вообще, main должен возвращать int

#include <stdio.h>
#include <string.h>

#include "String.h"

Choose a reason for hiding this comment

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

У меня такого нет, не компилится. Хотя если это просто удалить, всё ок (видимо, у Вас оно подключало string.h и всё хорошо было, а у меня на линуксе String.h и string.h — совершенно разные файлы, и одного из них нет).

const bool test(void)
{
const size_t testNumber = 10;
const char *const testStrings[testNumber] = {"ads34676_", "ва2345_3", "U", "F342", "QadfGfss_12343dfwgasf___", "2W", "Ф", "r", "", "432567854ew3"};

Choose a reason for hiding this comment

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

Си на самом деле так не умеет, надо testNumber через #define объявлять. Некоторые компиляторы позволяют выделять массив неизвестной во врем компиляции длины на стеке (не должно смущать, что testNumber const, Си разрешает менять константные значения), но это не по стандарту. gcc такое не компилирует.

const bool test(void)
{
const size_t testNumber = 10;
const char *const testStrings[testNumber] = {"ads34676_", "ва2345_3", "U", "F342", "QadfGfss_12343dfwgasf___", "2W", "Ф", "r", "", "432567854ew3"};

Choose a reason for hiding this comment

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

isalpha возвращает true, если в текущей локали символ является буквой. У меня локаль ru_RU.UTF-8, и ничего против "ва" не имеет, тесты не проходят :) Надёжнее было бы либо вручную сравнивать коды символов, либо не требовать в тестах, чтобы русские буквы не принимались (потому как чем они не буквы, да и любой современный компилятор идентификаторы с кириллицей обижать не станет).

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