Simple Sorcerer
I need to specify a folder with object files so that I can just specify the .o files.
Simple Sorcerer
it would simplify the makefile a bit
Simple Sorcerer
No one needs to link object files by themselves
Maybe I don't understand you. Write a simple command to compile the main.c file with compilation of object files to the build folder
Simple Sorcerer
I thought about it and realised it wouldn't simplify the makefile.
Suka
https://hastebin.com/share/kagepupuxe.cpp
https://onlinegdb.com/XSkL_Ld_l
Siddhanth
what error?
Idk...logical error i guess
Suka
Idk...logical error i guess
now you know. https://t.me/programminginc/512070
...
What kind of compiler do I program with C++ for Windows?
...
I couldn't find a source related to about
...
msvc
No, how do I compiler program myself?
Manav
No, how do I compiler program myself?
You want to make a C++ compiler yourself?
Manav
I'd suggest making a toy language first then making its compiler rather than trying to use C++
Manav
Go for a simpler grammar so you don't get bogged down by unnecessary details.
...
Go for a simpler grammar so you don't get bogged down by unnecessary details.
I know C++, but I'm wondering what kind of file is translated into system code
Manav
I know C++, but I'm wondering what kind of file is translated into system code
You know way too little to even ask a proper question. Try making a small language first, it's parser, etc. You'll understand how to generate a syntax tree, then transforming it into instructions.
Manav
After that you can come and ask here for help regarding makimg a C++ compiler and we'll help you
Manav
My English is bad
It's not english that's the problem my friend. I understood what you meant to do the 2nd time.
Manav
Can you suggest a source?
Find a course online which creates a toy language. You'll find plenty of resources online. There are books on compiler architecture which will teach you exactly what you want to know.
Manav
the books that i know are quite old but it should still be usable: 1. https://www.amazon.co.uk/Advanced-Compiler-Design-Implementation-Muchnick/dp/1558603204 2. https://www.amazon.co.uk/Modern-Compiler-Implementation-Andrew-Appel/dp/052182060X
Manav
Maybe other members can suggest better ones
Manav
here's a light read to get you introduced to the concept, https://www.freecodecamp.org/news/the-programming-language-pipeline-91d3f449c919/ it's decent-ish _-_
Manav
found a course: https://www.edx.org/learn/computer-science/stanford-university-compilers
Manav
Uhh.. compiles to mips 🫠 Oh well
Simple Sorcerer
Oh, I don't know anything about compiler creation, but I have an idea that it must be made somehow on top of assembly language.
Simple Sorcerer
I am only superficially familiar with ELF and EXE, but I think if you know their architecture, you can already do something useful.
Antonio
guys I need help. Let me start by saying I'm new to programming. do you have any advice on where to learn, for example ieterative loops, which if I have 2 fors nested with a while I get lost following the logic.
Antonio
And where can I learn the basics skills, for example to choose the best iterative loop
Simple Sorcerer
Stuff like that
For future reference, the simpler the code, the better it is. simple code = minimum errors.
Simple Sorcerer
Try using functions somehow. there is a while for every function
Simple Sorcerer
Try using functions somehow. there is a while for every function
I'm sure this way you won't lose your logic. but it depends more on the situation.
Simple Sorcerer
Stuff like that
It can also be useful to simply think about how to avoid or simplify cycles.
三体183号
I want to take the order,Do you have a boss
三体183号
My work is very boring.
三体183号
How to make money in your spare time?
三体183号
I have no creativity!
三体183号
I only know how to program
Suka
I only know how to program
ooo ic. try join freelance portal perhaps?
三体183号
For example?
三体183号
What do you do in your spare time?
三体183号
I'm Chinese.
Suka
For example?
Freelancer.c0m, fastwork, etc etc
Suka
What do you do in your spare time?
i have 2 children, i have no spare time hehe. (beside sleeping and watching isekai anime)
Suka
and iam from indonesia
三体183号
It's really a happy and fulfilling life.
Jose
Yeah but how do I think about simple solutions
Think about the 7+-2 rule: The human brain at short span only can handle an average of 7 things. If your code needs to store mentally 5 things, it's hard, but ok (don't think your coworker is Sheldon Cooper, think about a Ditto in front of a keyboard). If your code needs to store mentally 7 things or more, your code needs to be modified as soon as possible.
Jose
Yeah but how do I think about simple solutions
A simple trick works for me is draw. Grab a pencil and start drawing boxes with simple responsabilities inside of them. Do you need to open a file or do you need to store in RAM all your configuration file? The second one is not simpler than the first. In fact, the second one contains more than one responsability inside, for example. (The GTA online bug root was like this, in short terms)
\Device\NUL
Mmap :3
VirtualAlloc gang
\Device\NUL
Or just use malloc
𝔖𝔞𝔯𝔬
Guys how does the compiler sees passing functions as template arguments
𝔖𝔞𝔯𝔬
I looked at stack overflow but I had some isssues in understanding this concept
𝔖𝔞𝔯𝔬
Will the compiler actualy optimize it? Or it would compile it as a simple function pointer passed in as argument
Antonio
But I was searching for list of exercises that gradually taught me the loops
Manav
Will the compiler actualy optimize it? Or it would compile it as a simple function pointer passed in as argument
Depends on how the argument is passed. The template instantiations happens before when compiling the translation unit.
Antonio
But I was searching for list of exercises that gradually taught me the loops
Its ok even if they are only logic problem, so without the need to code
Manav
Will the compiler actualy optimize it? Or it would compile it as a simple function pointer passed in as argument
You can actually see this in action by generating a map file from the linker. Though i still don't fully understand your question
𝔖𝔞𝔯𝔬
You can actually see this in action by generating a map file from the linker. Though i still don't fully understand your question
What happens when you make template<funcionType function> void wrapper(){ function(); }
𝔖𝔞𝔯𝔬
That depends on how you instantiate it
typedef void (*functype) (void); void funcion(){ } wrapper<function>()
Manav
typedef void (*functype) (void); void funcion(){ } wrapper<function>()
void my_function() { std::cout << "Hello\n"; } typedef void (*funtype) (void); template <typename F> void fun() { F f = my_function; f(); } template <typename F> void fun2(F f) { f(); } int main() { fun<funtype>(); fun2(my_function); } consider this one
Manav
Look into main, how the two template functions are instantiated
Manav
Lemme generate a map file so you can see how the linker sees it.
Manav
Mangled names on my computer ??$fun2@P6AXXZ@@YAXP6AXXZ@Z ??$fun@P6AXXZ@@YAXXZ ?my_function@@YAXXZ
Manav
The function signatures are: void fun2<void (*)()>(void (*)()); void fun<void (*)()>(); void my_function();
Manav
You can take a look at the function signature, for fun2, The argument passed is void (*)(), function pointer