April
In fact, I have already started writing my own simple kernel, but I still want to know if there is a need to use C++ in practical work.
Danya🔥
But it's not necessary
Danya🔥
Proof of concept: https://github.com/SerenityOS/serenity
April
thanks for you sharing
Chat Boss
Danial sent a huge message, it has been re-uploaded as a file Hi everyone Can anyone help me out to fund out what is the * for in res *= i; Full program is : ..
\Device\NUL
Proof of concept: https://github.com/SerenityOS/serenity
I can't believe this is actually exist
\Device\NUL
@danialR8ja33wM4PU7sf i *= x is i = i * x
\Device\NUL
That's also apply to -=, +=, /= or even ^=
\Device\NUL
Why?
I don't expect people really using C++ for writing Kernel
\Device\NUL
Well Windows does use it afaik
Even though NT kernel has Everything is an Object Handle concept, its written using pure C afaik
⚛ Hz
windows even contains rust implemention of win32k component
\Device\NUL
Anonymous
I don't expect people really using C++ for writing Kernel
Well Google is implementing Fuchsia OS completely in C++. They are using C++17 btw https://fuchsia.googlesource.com/
Chat Boss
The Dark Side sent a code, it has been re-uploaded as a file
The
The Dark Side sent a code, it has been re-uploaded as a file
guys will that function complete exeuction before compiler executes next line here?
The
Wat
see the code
Danya🔥
see the code
So what? The question is not clear
The
So what? The question is not clear
sorry i'm overthinking.. but if there is no explicit thread created in func , it will always complete it's execution before next line executes right ?
João
Out of context question. What do you guys think about the philosophers problem in C
klimi
Out of context question. What do you guys think about the philosophers problem in C
what do you mean by your question? you mean how to solve concurrency? or how the problem is defined?
itsmanjeet
How to learn C++ in 21 days
Or you can check Jenny's lectures ❤️
itsmanjeet
Who is it?
Youtuber teacher
Danya🔥
Youtuber teacher
It is by default bad
klimi
How the problem is defined
https://en.wikipedia.org/wiki/Dining_philosophers_problem
Danya🔥
C++ Lectures in Russian Author: Konstantin Vladimirov, a former engineer at Intel and currently an engineering manager at Syntacore. With extensive expertise in developing compilers for various platforms using C++, Konstantin has been a prominent C++ educator at MIPT, one of Russia's leading universities. 1. Basic C++ Course: Designed for individuals with prior experience in C language and Algorithms, this course provides a solid foundation in C++ programming. Watch here: Basic C++ Course 2. C++ Course for Master's Students: Tailored for advanced learners, this course delves into cutting-edge concepts of C++, such as coroutines and concepts, elevating your understanding to a higher level. Watch here: C++ For Master's Students 3. Lectures on C++ Standard: For those seeking a deeper insight into the inner workings of C++, this series explores the intricacies of the language as specified in the standard. Watch here: Standard C++ 4. Informal Series of Lectures on GNU Toolchain: Gain practical knowledge and insights into the GNU toolchain through this engaging set of lectures. Watch here: Toolchain
Anonymous
Anyone tell me *p++ and(*p)++ difference See here second one will increment value of *p means dereference value But *p++ here why value of p gets increment *p wil first get dereference na
Azadi
Anyone tell me *p++ and(*p)++ difference See here second one will increment value of *p means dereference value But *p++ here why value of p gets increment *p wil first get dereference na
In *p++, you will have a copy of p used by * and "then" p gets incremented. In (*p)++ after using *p, the post-increment operator will increase what p points to not p itself.
Kasra
Hello guys, I hope you all are doing well,I made a minesweeper game project, but there are some bugs, can anyone help me in such a project?
Mehrad
Anyone tell me *p++ and(*p)++ difference See here second one will increment value of *p means dereference value But *p++ here why value of p gets increment *p wil first get dereference na
++ precedence is higher than * so in *p++ first p++ is done and that means p points to the next element and then *p section that means dereferencing the value of p++
Azadi
U mean p by address or dereference value ?
I didn't get your question.
Azadi
https://stackoverflow.com/a/15345591
There's a good point((*p)++ = val) in that link.
Azadi
++ precedence is higher than * so in *p++ first p++ is done and that means p points to the next element and then *p section that means dereferencing the value of p++
That's right that the post-increment operator precedence is higher than the * operator but the increment operator works by copies/temp objects. See this
Azadi
int p[]{ 1,2,3 }; int* it{ p }; for (int i = 0; i < 3; ++i) std::cout <<*it++ << ' '; std::cout << '\n'; for (int i = 0; i < 3; ++i) std::cout << p[i] << ' '; 1 2 3 1 2 3
Mustafa
Hello I hope your fine I want to make graphical interface for my c program using ncurses library. I need some turorials and samples in which the ncurses functions used. Thanks
V
Anyone available for 1 to 1 mentoring / pair programming in C and C++, DM me
V
To be mentored
O
What is way to merge string such as z= "an"+"ba" in this form without use variables
salary thief
Anyone available for 1 to 1 mentoring / pair programming in C and C++, DM me
well, I can, but it's better to post the question in group so that everything can be benefit
Mar!o
What is way to merge string such as z= "an"+"ba" in this form without use variables
Just do „an“ „ba“ The compiler will merge these two string literals into one at compile time
Anonymous
Isnt their any function to sort an array In c will i have to always use bubble sort or selection sort etc?
Anonymous
1. Don't use C 2. Google "qsort"
Hm i will do c++ soon Just want to know if their is any function
Anonymous
1. Don't use C 2. Google "qsort"
We still have to write a compare function for that
Foxner
Hi. I have a question about data structure alignment in C/C++. Is my understanding correct that individual members are packed if they fit within the word boundaries, rather than each element being aligned to its own word or datatype size boundary? Like this example for a 32-bit system: A B B _ C C C C where B is not aligned, but is contained in a single word, so it still requires just a single memory access, rather than A _ B B C C C C or A _ _ _ B B _ _ C C C C
Anshul
Can anyone tell me when to use set?
Anonymous
Can anyone tell me when to use set?
Brother see nowdays few ai tools are there which can help u in these things Even lot more better then us With a good explanation Eg: Chatgpt
663 942 1605 15 6 12 3
Hello friends. Thank you for the C and C Plus Plus books that you introduced on the channel. It was really great. Now I want to learn opengl, do you know a good source?
Anonymous
Can anyone tell me when to use set?
See set can be used when u have to check whether a element is present or not or finding intersection between 2 arrays etc And also used in bitwise and , or operator etc For more seee Google
O
Just do „an“ „ba“ The compiler will merge these two string literals into one at compile time
invalid operands of types ‘const char [3]’ and ‘const char [3]’ to binary ‘operator+’
Anonymous
Hi. I have a question about data structure alignment in C/C++. Is my understanding correct that individual members are packed if they fit within the word boundaries, rather than each element being aligned to its own word or datatype size boundary? Like this example for a 32-bit system: A B B _ C C C C where B is not aligned, but is contained in a single word, so it still requires just a single memory access, rather than A _ B B C C C C or A _ _ _ B B _ _ C C C C
Alignment requirements are architecture dependent. Assuming that your question is about a specific architecture which has strict alignment requirements where it is illegal to access memory that is not aligned for the type in concern If B is say a char then it doesn't have to be a word aligned (assuming a word is 2 bytes). It can be aligned at any byte and hence doesn't have to have padding bytes inserted before it. However the A before it may require special alignment requirements depending on its type. The alignment requirements most often depend on the type in question. Types like char don't have an alignment requirement while types like short and int require at the minimum a 2 byte alignment while types like long double and long long require 8 byte alignment. If you are doing embedded programming then you may run into special cases where types need to be aligned on a 64 byte boundary or a 128 byte boundary and in other cases even boundaries that are page aligned like for ex 4096 or 8192 byte aligned. In such cases you use the facilities provided by your OS like memalign or posix_memalign to get the correct alignment. So it depends on the type in question
Anonymous
We still have to write a compare function for that
How do you expect the compiler to be able to compare types you define without you specifying how they need to be compared? A simple memcmp won't work for all cases.
Anonymous
Only works with direct literals
He is talking about string literals being added with + operator. Only string literals that are separated by nothing but spaces in the source code are concatenated together. You can't add string literals because that would be akin to adding two char* pointers (C) or const char* pointers (C++) which is illegal
Foxner
Alignment requirements are architecture dependent. Assuming that your question is about a specific architecture which has strict alignment requirements where it is illegal to access memory that is not aligned for the type in concern If B is say a char then it doesn't have to be a word aligned (assuming a word is 2 bytes). It can be aligned at any byte and hence doesn't have to have padding bytes inserted before it. However the A before it may require special alignment requirements depending on its type. The alignment requirements most often depend on the type in question. Types like char don't have an alignment requirement while types like short and int require at the minimum a 2 byte alignment while types like long double and long long require 8 byte alignment. If you are doing embedded programming then you may run into special cases where types need to be aligned on a 64 byte boundary or a 128 byte boundary and in other cases even boundaries that are page aligned like for ex 4096 or 8192 byte aligned. In such cases you use the facilities provided by your OS like memalign or posix_memalign to get the correct alignment. So it depends on the type in question
I'm sorry, I should specify. By word I mean the processor word size (32 bits in this example). The sizes of A, B an C are 8, 16 and 32 bits respectively. What I'm wondering is, which of the following will be chosen by the compiler: 1. A, B and C are all 8-bit aligned as long as they fit into a single word boundary (eg. B B _ _, _ B B _ and _ _ B B) are all valid 2. A is 8-bit aligned, B is 16-bit aligned and C is 32-bit aligned (eg. only B B _ _ and _ _ B B) are valid 3. A, B and C are all 32-bit aligned (an entire 32-bit word is reserved for each of the members) I'm specifically curious about which option the compiler will choose on an architecture like x86 where unaligned accesses are allowed, but slower.
Anonymous
I'm sorry, I should specify. By word I mean the processor word size (32 bits in this example). The sizes of A, B an C are 8, 16 and 32 bits respectively. What I'm wondering is, which of the following will be chosen by the compiler: 1. A, B and C are all 8-bit aligned as long as they fit into a single word boundary (eg. B B _ _, _ B B _ and _ _ B B) are all valid 2. A is 8-bit aligned, B is 16-bit aligned and C is 32-bit aligned (eg. only B B _ _ and _ _ B B) are valid 3. A, B and C are all 32-bit aligned (an entire 32-bit word is reserved for each of the members) I'm specifically curious about which option the compiler will choose on an architecture like x86 where unaligned accesses are allowed, but slower.
Even on architectures where unaligned access is allowed, the compiler is allowed to enforce aligned access because they are faster and also because certain unaligned access instructions can lead to a SEGFAULT on architectures that allow unaligned access. So it is likely that a compiler that sticks to aligned access would choose this A _ B B C C C C for your use case. But this is not the only solution If the compiler can determine that unaligned access for these types won't be a problem then it may even choose A B B C C C C as the packing mechanism albeit at a slower access time cost. So you would have to test the implementation in concern on your own to see what was chosen with different optimisation levels enforced.
Anonymous
You could print the address of the first byte of B with the first byte of the structure to determine if there were padding bytes inserted
Azadi
invalid operands of types ‘const char [3]’ and ‘const char [3]’ to binary ‘operator+’
If you want to have "anba" by "an" + "ba", one way is to use auto z {std::string{"an"} + "bn"};.
Azadi
Or just "an" "ba"
Yeah, this way the type of z will be the same as the const string literals not anymore a`std::string.