Rejwana
& 2D & 3D memory representation
Евгений
Guys, are any one interested in assembly language here? If yes, reply. Thanks.
Евгений
I've got a nice book, published this year. ☺️👍
klimi
I've got a nice book, published this year. ☺️👍
if it is free, why just not share it instead of sending 2 messages?
Евгений
Of course it's free. But i can't send it here. 🙄
Евгений
But it's not in English, with full of examples
Евгений
if it is free, why just not share it instead of sending 2 messages?
It says, it's forbidden to publish multimedia here. So i can't send a PDF file.
Anonymous
It says, it's forbidden to publish multimedia here. So i can't send a PDF file.
Send it to one of the admins. If it is a free book, we can share it on your behalf. Only English books are allowed
Anonymous
Anyone can told me,what is memory padding? Or can anyone suggest me any video?
Memory addresses where an object is stored usually need to be a multiple of the sizeof the object. So if an object is 8 bytes long, it needs to be stored at an address that is a multiple of 8 for the object to be accessed efficiently. Some architectures enforce this requirement strictly while others are relaxed. These relaxed architectures however will need multiple operations to access these improperly stored objects. So suppose you have a struct that has a char and a double, then plain calculation tells us that the size of the struct would be 9. The char being of size 1 can be stored and accessed from any address. But the double can be accessed only if it is stored in an address that is a multiple of 8. So the compiler automatically adds 7 padding bytes between the char and the double thus making the size of the struct 16 bytes. Now this struct will be stored on 16 byte aligned memory address (the compiler will enforce this for you) and the entire struct as well as the char and double within it can be accessed efficiently albeit at the cost of 7 extra bytes.
Danya🔥
You cannot choose the address
Danya🔥
Memory addresses where an object is stored usually need to be a multiple of the sizeof the object. So if an object is 8 bytes long, it needs to be stored at an address that is a multiple of 8 for the object to be accessed efficiently. Some architectures enforce this requirement strictly while others are relaxed. These relaxed architectures however will need multiple operations to access these improperly stored objects. So suppose you have a struct that has a char and a double, then plain calculation tells us that the size of the struct would be 9. The char being of size 1 can be stored and accessed from any address. But the double can be accessed only if it is stored in an address that is a multiple of 8. So the compiler automatically adds 7 padding bytes between the char and the double thus making the size of the struct 16 bytes. Now this struct will be stored on 16 byte aligned memory address (the compiler will enforce this for you) and the entire struct as well as the char and double within it can be accessed efficiently albeit at the cost of 7 extra bytes.
I don't quite agree with the explanation Addresses of objects can be either aligned or not. An aligned address is such that is multiple of some constant, usually 4 or 8. In some CPUs (x86) reading at aligned addresses is faster than at non-aligned ones. In others CPUs (lower-end ARMs) you can read at aligned addresses abd if try to do the opposite — you get an exception. To take into account this, if a compiler sees that the size of an object is not aligned with the CPU alignment, it adds the paddings
Danya🔥
I did mention that there are relaxed architectures where the padding is not required and unaligned access happens in multiple read operations. Since the question was on padding bytes I focused on architectures where such access is faster or is required
> Memory addresses where an object is stored usually need to be a multiple of the sizeof the object This doesn't seem to be correct Memory address and size of an object don't have to be multiples of each other They have to have common divisor which is the CPU alignment constant
Евгений
Send it to one of the admins. If it is a free book, we can share it on your behalf. Only English books are allowed
Oh, really? Only English? Well, it's in russian, and only for russians. Not russians are not allowed to read this book. You can learn from old books. And it's free only for russian people. Sorry. It's time to learn russian.
Кайденович
Any good video courses to learn C++?
Danya🔥
Any good video courses to learn C++?
https://youtube.com/@tilir Since you can speak Russian, this guy has probably the best C++ courses on the entire YouTube
Anonymous
> Memory addresses where an object is stored usually need to be a multiple of the sizeof the object This doesn't seem to be correct Memory address and size of an object don't have to be multiples of each other They have to have common divisor which is the CPU alignment constant
I get what you are saying. But it still doesn't prove why what I said is wrong. I am not saying an object of size 12 bytes needs to be stored on address that is a multiple of 12. The compiler will add padding bytes to ensure this is an aligned access and make it aligned on a 16 byte boundary. This need not be just 4 and 8 like you said. I know of architectures where aligned access can be multiples of 2 for 2 bytes, 4 for 4 bytes, 8 for 8 bytes till 64 for 64 bytes. Anything beyond will still be required to be multiples of 64 and the CPU can access it. On such an architecture an object that is 128 bytes long will still be stored on a 64 byte boundary. The CPU alignment constant is not exactly a term. Different architectures have different requirements. Unaligned architectures are what I mentioned as relaxed architectures in my previous post
Кайденович
But I'm looking for something in english
Кайденович
For a friend who doesn't speak Russian
Danya🔥
But I'm looking for something in english
There is no good courses in English
Кайденович
I see
Danya🔥
There is no good courses in English
At least that I'm aware of
Кайденович
Thank you for your help
Anonymous
Thank you for your help
Check out https://hackingcpp.com/cpp/educational_videos.html It is not a tutorial per se but a good collection of videos on YouTube primarily those from CppCon. A guy who has programmed in some other language before might be able to use this to learn C++. So it is not for complete beginners.
Кайденович
Thank you
Mohamed
There is no good courses in English
https://www.udemy.com/course/cpp-deep-dive/ I'm not a C/C++ expert, but the course is quite well praised and regarded. I enrolled in it long time ago but has been moving along with him quite slowly
Віктор
hello guys. i want to add CI/CD to my project in visual studio(C++). I add my project to github, after that i add in project file "c-cpp.yml" with this code: name: C/C++ CI on: push: branches: [main] pull_request: branches: [main] jobs: build: runs-on: windows-latest steps: - uses: actions/checkout@v2 - name: Build and Test run: | MSBuild /t:Build /p:Configuration=Release .\path\to\your\test\executable.exe and i can't get, what i should do after that.
Danya🔥
> .\path\to\your\test\executable.exe And do you think this is the correct path?
Danya🔥
And I'd suggest you not to use msbuild but CMake Even for Windows only projects
Strife
Friends, how do I add the Overloading to this code?
Strife
#include <iostream> using namespace std; class a{ protected: static int x; }; int a::x=3; class b : public a{ public : void f(int n) {cout<<x+n;} }; main( ){ b t; t.f(2); }
Віктор
Follow github guides on GitHub actions
how i undestood, i should add "c-cpp.yml" only in Github, am i right?
Danya🔥
how i undestood, i should add "c-cpp.yml" only in Github, am i right?
You are not giving enough context and I've never used GitHub Actions with MSBuild projects thank God
Anonymous
https://www.udemy.com/course/cpp-deep-dive/ I'm not a C/C++ expert, but the course is quite well praised and regarded. I enrolled in it long time ago but has been moving along with him quite slowly
Please don't recommend Abdul Bari's course for C++. He is another guy like Yashwant Kanitkar (probably better because he atleast has a semblance of understanding of data structures and algorithms). But his knowledge of C++ is poor and often he recommends non standard C++ hacks like for example in his Linked list lectures. I followed his course when I was in college but realized how bad it was only after reading Stanley Lippman's book. He is a horrible C++ teacher as are the other well known authors from India. As a hindsight, there is no good C++ author or lecturer from the South Asian hemisphere.
Strife
What do you mean by overloading here?
Honestly, our teacher asked us to add Operator Overloading to it
Anonymous
Honestly, our teacher asked us to add Operator Overloading to it
I don't understand. Do you intend to overload method f in class B? And what exactly do you want to do different in this method?
Anonymous
Honestly, our teacher asked us to add Operator Overloading to it
I just read your post again. Operator overloading is different from method overloading. What exactly did your teacher ask you to do? Does he/she want you to overload the addition operation or does he/she want you to overload the f method?
Natanim
Can someone help me with my code
F
Hello
Nisdike
Hello 👋
Nisdike
How to start c++?? Any suggestions ?
klimi
How to start c++?? Any suggestions ?
you mean how to start programming in c++?
Nisdike
you mean how to start programming in c++?
Yep..i can't find a good source
Danya🔥
Yep..i can't find a good source
Read the rules in the pinned message
Nisdike
Ok
Alex
You may ask at Bjarne Stroustrup
Alex
I sure he know c++
Danya🔥
You may ask at Bjarne Stroustrup
Don't bother Bjarne please
Alex
Don't bother Bjarne please
Why. Because he is supporting Rust?
Danya🔥
Why. Because he is supporting Rust?
Because he has other stuff to do, obviously
Ludovic 'Archivist'
Why. Because he is supporting Rust?
Because he is getting old and is already busy teaching and working on the standard
Ludovic 'Archivist'
How to start c++?? Any suggestions ?
Read the pinned message, get a good book, find a teacher, or do all three
Andre
Is solving codeforces problems help actually with software engineering or should i focus more reading books
Danya🔥
Is solving codeforces problems help actually with software engineering or should i focus more reading books
Algorithm & Data Structures skills may be useful at a software engineering job if the job is something harder than "buttons coloring" Also, it may help you land your first job or internship(s), because MAANG companies love to ask algorithmic problems at their interviews, especially for lower-grade positions But it's not the only skill you need to be successful at a software engineering job, so you should not limit yourself only with the codeforces
Andre
Thank you.
klimi
read the rules
Anonymous
Need to learn the language
Anonymous
Need to learn the language
buy a book and type all, no past en copy, im sure that help's alot.
Divyanshi
Hey! Can anyone give some cool project ideas that I can work on in a group of 5?
Anonymous
You can actually work on an Online transport booking system. C# for the interface and then embed a database system to manage the back end. It can also be paying
Divyanshi
Actually I have to make a project for an upcoming internship to put in my resume
Anonymous
No C# here
For the interface
Divyanshi
Ohk Can you suggest more?