Skip to content

Serohin serhii hw 03 - #40

Open
sserohin wants to merge 6 commits into
mainfrom
Serohin_Serhii_HW_03
Open

Serohin serhii hw 03#40
sserohin wants to merge 6 commits into
mainfrom
Serohin_Serhii_HW_03

Conversation

@sserohin

@sserohin sserohin commented Nov 6, 2020

Copy link
Copy Markdown
Collaborator

No description provided.

@ghost

ghost commented Nov 6, 2020

Copy link
Copy Markdown

Congratulations 🎉. DeepCode analyzed your code in 2.809 seconds and we found no issues. Enjoy a moment of no bugs ☀️.

👉 View analysis in DeepCode’s Dashboard | Configure the bot

Comment thread HW_03_01.cpp
@@ -0,0 +1,41 @@
#include "cstring"
#include <bits/stdint-uintn.h>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

а зачем тут этот заголовочный файл? есля я правильно понимаю то он не переносимый

Comment thread HW_03_01.cpp
#include <cstring>
#include <iostream>

static bool string_reverse(char *string, size_t len);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

как по мне и частый на практике это пишут сразу тут определение, так как потом по коду проще понимать как юзается ниже эта функция

Comment thread HW_03_02.cpp
std::cin >> temp;
std::cout << std::endl;

if (!array_init_sorted(temp, array, NEW_SIZE)) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

а зачем тут делать NEW_SIZE как i + 1, чтобы потом в array_init_sorted сделать size - 1?

Comment thread HW_03_02.cpp
#include <cstdlib>
#include <iostream>

bool array_init_sorted(uint32_t new_member, uint32_t *array, size_t size);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

static?

Comment thread HW_03_03.cpp
size_t selected_size{};
std::cout << "Input an array size in range [1 ... " << MAX_SIZE << " ]"
<< std::endl;
param_init_safety("Array size -->", &selected_size);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

а почему это не сделать как возращаемое значение, зачем его передавать как ссылку

Comment thread HW_03_03.cpp
std::cout << "IN RANGE! ";
std::cout << MIN << " <= " << array[i] << " && " << MAX
<< " >= " << array[i] << std::endl;
array_remove_cell(array, size, i);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

а зачем ее делать как bool и ее не проверять?

Comment thread HW_03_04.cpp
static inline char to_upper(char letter) {

constexpr char LOW_CASE_FLAG{0x60};
constexpr char UP_CASE_FLAG{0x40};

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

а что такое 0x60 и 0x40? может лучше явно писать символьные литералы?

Comment thread HW_03_04.cpp
Comment on lines +21 to +22
return letter & LOW_CASE_FLAG ? (letter & ~LOW_CASE_FLAG) | UP_CASE_FLAG
: letter;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

чем этот код лучше если вы напишите чем простой if?
зачем писать код в который нужно вникать чтобы понять что вы просто преобразовываете в нижний регистр

Comment thread HW_03_05.cpp
static bool is_digit(char digit) {

constexpr char DIGIT_FLAG{0x30};
return (digit & DIGIT_FLAG) == DIGIT_FLAG;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

return digit >= '0' && digit <= '9';

просто и понятно

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