Похожие чаты

C and Assembly in this case?

16 ответов

6 просмотров

you can see assembly code as an middle step, between the C code and the machine code. but you don't usually write assembly code yourself, the compiler translate it for you. C code -> [Compile] -> x86 assembly -> [Assemble] -> machine code you can if you want write assembly code yourself, and event mix it with C code

Charlemagne-Holdt Автор вопроса
Jonathan Péclat
you can see assembly code as an middle step, betwe...

Damn, so in order to learn and run C, you also gotta learn Assembly as well?

Charlemagne-Holdt Автор вопроса

What is that [Compile]? Is there a type of compile?

Charlemagne Holdt
What is that [Compile]? Is there a type of compile...

by "Compile" I mean the step in the compiler that translate the C Code into assembly. The details of how a C code is compiled is complex. There are a lot of steps.

Charlemagne-Holdt Автор вопроса
Charlemagne Holdt
So there is only one type of compiler?

I don't understand the question. A compiler is a program that compile or "translate" if you like the code into assembly. There are many compilers on the market that you can use (for free). I think the most used is GCC for instance.

Charlemagne-Holdt Автор вопроса
Jonathan Péclat
I don't understand the question. A compiler is a p...

Ok, if this is how C code translates into machine language, C code -> [Compile] -> x86 assembly -> [Assemble] -> machine code How do you use compiler at the [Compile] part? And where do you download it from? Or once you download C language package(just like Python package), does compiler come with C package as well?

Charlemagne-Holdt Автор вопроса
Charlemagne-Holdt Автор вопроса
Jonathan Péclat
I don't understand the question. A compiler is a p...

The latter statement, I see. So ther are many types of compilers.

Charlemagne-Holdt Автор вопроса
Charlemagne Holdt
Ok, if this is how C code translates into machine ...

to use the compiler part you can either call it directly like this in a terminal gcc -o program.bin main.c This will take the C code in main.c and compile it into an executable "program.bin". in fact unless you ask otherwise the compiler program does the [Assembly] part as well by default. Or if you don't want to invoke the compiler yourself you can use a Makefile. You can also use an IDE like XCode on MacOS to make it easier.

Charlemagne Holdt
Ok, if this is how C code translates into machine ...

you can ask the compiler to stop and don't do the Assembly part like this if you are interrested to see the assembly code. gcc -S main.c

Charlemagne-Holdt Автор вопроса
Jonathan Péclat
to use the compiler part you can either call it di...

It looks like the work of compiler can only be done on Terminal?

Charlemagne Holdt
I’m on MacOS

xcode bundles llvm/clang

Похожие вопросы

Обсуждают сегодня

А еще в перле можно уже @arr1 + @arr2?
Sergei Zhmylove
53
Подскажите, где смотреть результат выполнения программы? Код: ;.686 ;Система команд процессора 686 ;.MODEL FLAT,stdcall ;Модель памяти плоская, станда...
Егор Анелькин
5
я не магистр хаскеля, но разве не может лейзи тип конвертнуться в не-лейзи запросив вычисление содержимого прям при инициализации?
deadgnom32 λ madao
100
I arrived here after a Chico Crypto show highlighted the project & the Team - the fact that the Team had a long history of successfully working with household names gave me e...
Banter is Bullish
1
Привет всем. появился вопрос. Разрабатываю сайт, в данный момент он запущен. Хостинг beget. Добавляю на сайт яндекс метрику с помощью полей client-settings (взято отсюда http...
Andrew
2
;.686 ;Система команд процессора 686 ;.MODEL FLAT,stdcall ;Модель памяти плоская, стандартный ;вызов процедуры ;option casemap:no...
Егор Анелькин
1
Почему у макбука экран не сенсорный?
✨ Anatolii Cherednichenko
28
почому оно не работает?
Vi Chapmann Chapmann
19
It's unfortunate that the "Then why are you here" or "lol you must've bought high" mantras always come up. I already tried bringing up this subject in the price channel but si...
Leroy Gerrits
4
Так а кто может спарсить всех участников чата? Идишники
Magic
17
Карта сайта