klimi
this group is not for job postings, please respect the rules of this group
\Device\NUL
Bro forgor he's on C not Python
Gilad
Bro forgor he's on C not Python
Bro is new to C with previous experience in python.
\Device\NUL
Bro is new to C with previous experience in python.
Didn't compiler gives warn to you?
Gilad
It did. I didnt understand the statement.
\Device\NUL
It did. I didnt understand the statement.
That's it. There's something wrong with your code if the compilers give warning
\Device\NUL
Python print() formatting is similar to C printf()
Anonymous
hi i'm having a hard time to print an address of first element of an array in the hex format using write function can someone help me
\Device\NUL
why not use printf?
native system API i think
💰💵⚛️💹⚛️💵💰
hi i'm having a hard time to print an address of first element of an array in the hex format using write function can someone help me
https://man7.org/linux/man-pages/man3/printf.3.html read the printf docs, there is conversion specifiers
Anonymous
i can't use printf
klimi
i can't use printf
it's in <stdion.h> you should be able to use it
Anonymous
''' using ConstIterator = BasicIterator<const Type>; [[nodiscard]] ConstIterator cbefore_begin() const noexcept { // Реализуйте самостоятельно return ConstIterator {const_cast<Node*>(&head_)}; }''' why I cant create '''const Node* node = &head_''' and pass it to ConstIterator constructor witout making const_cast?
Anonymous
Probably because the ConstIterator constructor accepts pointer to a non-const value? :)
than it makes const? because I read that const_cast remove constness
Anonymous
How should I know?
I am just trying to make it clear, the constructor explicit BasicIterator(Node* node): node_(node) { }
Anonymous
which accepts non-const pointer
Danya🔥
So that's your answer
Anonymous
so, I understand right that using ConstIterator = BasicIterator<const Type> is const Type but its constructor accepts non-const pointer than I need to remove constness from const Type?
Danya🔥
Please use formatting when pasting the code
Anonymous
I cannot know that By the little pieces you're sharing it's not possible to make any valid assumptions
thank you anyway. It is actually like you have said the constructor takes non-constant pointer
Danya🔥
Anonymous
It did. I didnt understand the statement.
An
You should not declare a data field that can be derived from other data fields. For example, the following Person class has two data fields: birthDate and age. Since age can be derived from birthDate, age should not be declared as a data field. class Person { public: ... private: Date birthDate; int age; }
It says you shouldn't ask for unnecessary info, such as an age and birthdate at the same time.. since you can get the age from the birthdate why would you put extra effort on the user and make him enter both birthdate and age? I think this is the meaning.
AlanCcE
I got a serious problem in implementing vs code for coding c, I tried every way in google but I always get errors coding with vs code, dont you know of a good link to teach how to ?
VIM could be a better solution to you, i already tried to use VSCODE for C coding but i had several errors https://opensource.com/article/19/3/getting-started-vim
איליה
Sup guys. I’m about to learn c++ and I have a question: what ide do you use?
איליה
Code::blocks
What bout Fleet and CLion?
Ludovic 'Archivist'
What bout Fleet and CLion?
CLion is pretty good, but beyond C++ you will have to learn the CMake build system
איליה
CLion is pretty good, but beyond C++ you will have to learn the CMake build system
Ah, but, I think that’s okay, isn’t it? I can know more
Ludovic 'Archivist'
Codeblocks, Visual Studio Community Edition and Codelite are probably the easiest for absolute beginner
איליה
Codeblocks, Visual Studio Community Edition and Codelite are probably the easiest for absolute beginner
I need to learn c++ because of my job, I’m Swift Developer, and I needed c++
labyrinth
there is a piece of code in absl: template <class F, class... Ts, class P = Policy> static auto apply(F&& f, Ts&&... ts) -> decltype(P::apply(std::forward<F>(f), std::forward<Ts>(ts)...)) { return P::apply(std::forward<F>(f), std::forward<Ts>(ts)...); } what does the part ->decltype mean ?it is basically a function signature followed by this part.
Ludovic 'Archivist'
I need to learn c++ because of my job, I’m Swift Developer, and I needed c++
Mmmmh, if you are confident you can learn fast, I would say CLion will have the best quality of life on MacOS
Ludovic 'Archivist'
I need to learn c++ because of my job, I’m Swift Developer, and I needed c++
BTW, it will take time to become proficient and productive so don't get too frustrated and strive for code that is easy to read. It will definitely help you to get started
Матin Salehizade
use VIM
I finally fixed the problem, reinstalling the compiler.
(-__-)
#include <iostream> #include <string> using namespace std; class A { public: A() { }; string s("abc"); }; int main() { A a; cout << a.s << endl; return 0; }
(-__-)
#include <iostream> #include <string> using namespace std; class A { public: A() { }; string s("abc"); }; int main() { A a; cout << a.s << endl; return 0; }
Hello everyone, why I can't initialize string s as shown in the bold line.. but if I write ( string s = "abc" ) there will be no problem ?
Lorenzo
You have to initialize s in the constructor of your class
Lorenzo
In the .cpp
(-__-)
yes, I know, but if I write ( string s = "abc ) there will be no problem ...
Anonymous
there is a piece of code in absl: template <class F, class... Ts, class P = Policy> static auto apply(F&& f, Ts&&... ts) -> decltype(P::apply(std::forward<F>(f), std::forward<Ts>(ts)...)) { return P::apply(std::forward<F>(f), std::forward<Ts>(ts)...); } what does the part ->decltype mean ?it is basically a function signature followed by this part.
Also note that the statement inside the function is exactly the same as the one inside the decltype. This is redundant and a stupid design decision from the standard committee members. Using auto to infer the return type helps alleviate this problem. So you don't have to write code like this anymore. The compiler can be asked to infer the return type like this: template <class F, class... Ts, class P = Policy> static auto apply(F&& f, Ts&&... ts) { return P::apply(std::forward<F>(f), std::forward<Ts>(ts)...); }
Anonymous
#include <iostream> #include <string> using namespace std; class A { public: A() { }; string s("abc"); }; int main() { A a; cout << a.s << endl; return 0; }
You can't use parenthesis for in class initialisation of class members. This stems from a problem that C++ parsers had in the past and still have. Resolving this requires a change in the grammar rules and this was not a backwards compatible change and hence the standard disallows it. There are two options however. You can either initialize using curly braces like this string s {"abc"}; or use copy initialization like this: string s = "abc";
vikram
Hello window 10 problem for Ms turbo c++ not running program after one time and not supporting keyboard and mouse
vikram
Plss somebody help me
klimi
Hello window 10 problem for Ms turbo c++ not running program after one time and not supporting keyboard and mouse
i don't think that using turbo c++ in this age is a good idea, choose something modern
Anonymous
Hello window 10 problem for Ms turbo c++ not running program after one time and not supporting keyboard and mouse
Turbo c++ is an ancient and a non standard compiler. So no one can help you with it.
Anonymous
Okay how to solve these problem
Go to the Resources channel in the link mentioned above. You will find a detailed post there offering various alternatives and standard compliant compilers there
klimi
Okay tell me something other software
for compiler choose either MSVC/GCC/CLANG for the IDE you can choose between visual studio, clion or just with editor like visual studio code or even simpler like sublime text or any other editor you are familiar with
'''''''
Help with what might be wrong with my code? https://gist.github.com/giladal/5a5cd3936fa60940b81dba53b654841f
j++ in the inner for loop, not i++ Also use ++x instead of x++ (wherever possible), pre-increment is a bit faster than post-increment
Anonymous
As I have been reminded so many times, Visual Studio Code is no longer just an editor. With its plugin ecosystem it is close to a full fledged IDE minus the compiler. I myself have switched to VSCode from Vim (I still use Vim plugin for easy navigation) and I am just in love with it. The only Microsoft product that I can proudly claim to use.
Anonymous
I call these things an editor, the same way as vim/emacs are editors (even though you can extend them... so maybe extensible editors?)
Well then TBH, by your definition CLion is also not an IDE (I think it is an IDE) because you will have to install the compiler, linker and debugger outside of it and then configure it to point to the installed binaries just like you do in VSCode. The only difference between VSCode and CLion is that you will have to install certain additional plugins for VSCode.
klimi
but i agree on that point that IDE/editor boundary is broken
𝔖𝔞𝔯𝔬
How can I call a base class constructor in a subclass?
Chat Boss
M O H I T K U M ∆ R sent a code, it has been re-uploaded as a file
Danya🔥
How can I call a base class constructor in a subclass?
In the initialization list of the subclass constructor
M O H I T
hey could you please check my above code
Anupam2.7
Assembly maybe
-
hi does anyone know how to copy a text from a file to clipboard in C?
-
OS?
windows
Lorenzo
const char* output = "Test"; const size_t len = strlen(output) + 1; HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, len); memcpy(GlobalLock(hMem), output, len); GlobalUnlock(hMem); OpenClipboard(0); EmptyClipboard(); SetClipboardData(CF_TEXT, hMem); CloseClipboard();
Lorenzo
Cannot paste stackoverflow link but..just search on google, there are plenty of examples
Lorenzo
SetClipboardData is the key
-
SetClipboardData is the key
Thanks for your help❤️