Skip to content

Comments

Homework#1

Open
shannami wants to merge 8 commits intomainfrom
homework
Open

Homework#1
shannami wants to merge 8 commits intomainfrom
homework

Conversation

@shannami
Copy link
Owner

@shannami shannami commented Oct 7, 2025

дз №4 сортировка Шалахина Анна

@shannami shannami requested a review from WoWaster October 7, 2025 15:32
Copy link
Collaborator

@WoWaster WoWaster left a comment

Choose a reason for hiding this comment

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

И инструкии нет :(

sort/sort.h Outdated
#define SORT_H

// arr - указатель на массив, n - количество элементов (<=100)
void asm_sort(int *arr, int n);
Copy link
Collaborator

Choose a reason for hiding this comment

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

У нас camelCase

Copy link
Collaborator

Choose a reason for hiding this comment

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

И звёздочки у Вас стоят по-разному. Вы руками форматируете?

sort/sort.h Outdated
@@ -0,0 +1,7 @@
#ifndef SORT_H
Copy link
Collaborator

Choose a reason for hiding this comment

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

По стайлгайду --- #pragma once

sort/sort.c Outdated
if (arr[i] != original[i]) ++changed;
}

printf("%d\n", changed);
Copy link
Collaborator

Choose a reason for hiding this comment

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

По условию требовали другого.

sort/sort.c Outdated
Comment on lines 10 to 11
int val; //прочитанное число
char sep; //пробел или /n
Copy link
Collaborator

Choose a reason for hiding this comment

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

Надо инициализировать

sort/sort.c Outdated
}

// копирование массива для того чтобы потом сравнивать эллементы
for (int i = 0; i < n; ++i) original[i] = arr[i];
Copy link
Collaborator

Choose a reason for hiding this comment

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

В одну строчку не принято писать

sort/sort.c Outdated

asm_sort(arr, n);

// сравниваем, считаем склько чисел при сортировке поменяло значение
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// сравниваем, считаем склько чисел при сортировке поменяло значение
// сравниваем, считаем сколько чисел при сортировке поменяло значение

sort/sort.h Outdated
@@ -0,0 +1,3 @@
#pragma onec
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
#pragma onec
#pragma once

Comment on lines 1 to 2
gcc -Wall -Wextra -pedantic -c sort.c -o sort.o
gcc -Wall -Wextra -pedantic -c sort1.s -o sort1.o
Copy link
Collaborator

Choose a reason for hiding this comment

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

А флаги для оптимизации?

Comment on lines +1 to +3
#include "sort.h"
#include <stdio.h>
#include <stdlib.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Кажется, вот здесь в конце пробел из-за котого у Вас крестик.

Comment on lines +1 to +3
gcc -O2 -Wall -Wextra -pedantic -c sort.c -o sort.o
gcc -Wall -Wextra -pedantic -c sort1.s -o sort1.o
gcc sort.o sort1.o -o prog No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

Я перестал понимать, что здесь происходит. И, видимо, в прошлый раз прочитал по диагонали. Во-первых, Вы здесь никак не получается файл на языке ассемблера. Во-вторых, оптимизацию Вы применяете к файлу с main, а не к файлу с сортировкой

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