Anonymous
Is git also dead for y'all?
Anonymous
nothing to commit, working tree clean Username for 'https://github.com': TruncatedDinosour Password for 'https://TruncatedDinosour@github.com': remote: Password authentication is temporarily disabled as part of a brownout. Please use a personal access token instead. remote: Please see https://github.blog/2020-07-30-token-authentication-requirements-for-api-and-git-operations/ for more information. fatal: unable to access 'https://github.com/TruncatedDinosour/website.git/': The requested URL returned error: 403
Anonymous
Working fine for me
Hm, I cannot push to mine, let me read that articlw
Ehsan
I will add it to pastebin
Ehsan
I am using Apple Clang if that helps
Parth
Anyone who wants to revise c++
Anonymous
https://pastebin.com/ekQjFcdY
This should be fine. Since you are calling join in the main func, treeT should live atleast as long as the threads are executing. So capturing them by reference in the lambda that the thread executes should be fine.
Anonymous
Working fine for me
Just read about it, you will have to use ssh keys or access tokens from min-2021
Anonymous
which is near
Anonymous
Me
Anonymous
Are you sure this is the only place where you are accessing the mutexes? It could be the case that they are being accessed somewhere else as well. Try using a debugger with threading support and find out where it crashes and what the thread was doing at that time.
Ehsan
okay I got it
Ehsan
I am so fucking stuppid, I want to kill myself 😢😢😢😢😢😢
Ehsan
I got the problem
Ehsan
It was so stupid
Ehsan
``` uint32_t id_; ``` I didn’t initialize it to 0
Ehsan
It basically tried to access invalid address in the array
Anonymous
``` uint32_t id_; ``` I didn’t initialize it to 0
Hmm, the code you showed doesnt even use that member but.
Ehsan
uint32_t id_;
Ehsan
I thought this was initialized to 0 automatically
Ehsan
lmao 😂😂😂😂😂😂😂😂😂😂😂
Anonymous
I thought this was initialized to 0 automatically
No. Class members are default initialized and not value initialized.
Ehsan
Java runs on my blood
Anonymous
#include <stdio.h> struct student { char firstName[50]; int roll; float marks; } s[10]; int main() { int i; printf("Enter information of students:\n"); // storing information for (i = 0; i < 5; ++i) { s[i].roll = i + 1; printf("\nFor roll number%d,\n", s[i].roll); printf("Enter first name: "); scanf("%s", s[i].firstName); printf("Enter marks: "); scanf("%f", &s[i].marks); } printf("Displaying Information:\n\n"); // displaying information for (i = 0; i < 5; ++i) { printf("\nRoll number: %d\n", i + 1); printf("First name: "); puts(s[i].firstName); printf("Marks: %.1f", s[i].marks); printf("\n"); } return 0; }
Puspam
What does s[10] means?
Array named s which can hold upto 10 items of the student structure.
Anonymous
Yes
Or s[i] ka mtlb ?
Puspam
Or s[i] ka mtlb ?
It is just to get the value from the array at position i. You can write like this to get the 10 values: s[0] s[1]....... s[9] But it will be tedious. So, a loop is used to go from 0 to 9 and access the values of the array.
Ehsan
No. Class members are default initialized and not value initialized.
Can you help me with this? Sorry its a stupid question. What is the best way to return this data field on my class? std::vector<boost::geometry::index::rtree<value, Parameters>> tree_;
Anonymous
Can you help me with this? Sorry its a stupid question. What is the best way to return this data field on my class? std::vector<boost::geometry::index::rtree<value, Parameters>> tree_;
You shouldnt be returning it. It should be encapsulated within your class. It should not be pushed around because it will break your thread safety and your code will no longer be thread safe. If you must return it and there is no other way around it, there are 2 options: 1) If your code semantics is that of some processing following which you return the result and you dont do it often, then return it by value. 2) if option 1 doesnt apply, then try using a std::atomic<shared_ptr> (in this case the vector will be allocated on the heap).
V01D
No?
Kanni
/get cppbookguide
Gulshan
#include <stdio.h> #include <string.h> int main() { char test[100] = "nnnlkfnnlkcnlknjbwoinwbeboenudinnaonfonsndspfnoieapncpinapn" "fineoifnoindsdconjoindpdiqwjpodlzxipcnbwe"; // char test[2] = "he"; // 2 printf("%lu", strlen(test)); // 102 }
Gulshan
Idk why, it is printing 102, but it is supposed to print 100 naa?
Vlad
Idk why, it is printing 102, but it is supposed to print 100 naa?
Your array must also have the sufficient size for the null terminator
Vlad
while(*str++) ++count;
Vlad
That's basically strlen code
Anonymous
welcome
Manav
https://pastebin.com/Kr1WkG4P
Manav
why insertion at end linked list is not workinng
Anonymous
why insertion at end linked list is not workinng
Line 15: ptr->next != NULL —> ptr != NULL
Manav
Line 15: ptr->next != NULL —> ptr != NULL
Bro it works but I inserted 4 elements but it shows 5 element 5th element-> 0 How?
Manav
Ok I got it
Good
I need to integrate third-party library (static) in my project using cmake.In my project there are around 10 applications all are depending on the third party library.In third party library there are multiple *.so file.So it's difficult to link all .so files in all applications.Is there any better solution to solve this issue?
Anonymous
Please can you help us with looping statement?
Anonymous
Please can you help us with looping statement?
for (int i = START_OF_INDEX; i < ITERATION_COUNT; ++i) { }
Anonymous
I need to integrate third-party library (static) in my project using cmake.In my project there are around 10 applications all are depending on the third party library.In third party library there are multiple *.so file.So it's difficult to link all .so files in all applications.Is there any better solution to solve this issue?
First of all .so files are not static libraries. You said you want to link with static libraries. So you should be linking with .a files. And as far as your problem with linking the same files in all the application files, you can set a non persistent global property list that includes all the .so names or the .a names. Set this at the top level CMakeLists.txt files and use this property in the target_link_libraries at the individual application level.
Shahar
Is there an easy way to "try" various syntax stuff in C/C++, without always compiling->executing? Like for Python we have the Interpreter for this.
Abdulaziz
/get ide
Anonymous
Is there an easy way to "try" various syntax stuff in C/C++, without always compiling->executing? Like for Python we have the Interpreter for this.
Python is an interpreted language. So you have tools like that in Python. C++ is a compiled language. There are scenarios in C++ where errors can be determined at lexer level, parser level, semantic analysis level and at linking level (not because libraries are missing but because template instantiations did not happen as you expected). So you cant have something like an interpreter for C++. Having said that, there are a lot of REPL tools for C++ which support a very small subset of C++ to try out C++ code. These obviously dont support a vast majority of the C++ expressions.
Anonymous
Factor of 4 Is 1 ,2 ,4 I want to print 3 as answer number
Do you mean wap to find factors of a given number and print only prime factor?
Anonymous
Your qn isn't clear. Make it clear
Abdulaziz
/get cppbookguide
Anonymous
Python is written in C
Anonymous
Yeah, I see. But eventually Python uses C as its compiler, no?
Python is interpreted.. u dont have to compile
Anonymous
It doesn't mean C is the compiler.
Anonymous
For python
Anonymous
Yeah, I see. But eventually Python uses C as its compiler, no?
The interpreter for Python can be written in any language. It was written in C for historical reasons and still continues to be written in C. There is nothing to stop you from using LLVM APIs to write a Python interpreter in C++.
Shahar
But, if it uses a layer of C code for its `statement`s, so the `C` code has to be compiled for "each statement". No?
Ah, you mean in Python, the VM (written in C) is actually an executable receiving as an input Python code, and converting it to is suitable byte-code, which is in its turn decoded to machine-code using an LLVM?
Anonymous
But, if it uses a layer of C code for its `statement`s, so the `C` code has to be compiled for "each statement". No?
You are confusing Python with Cython. For Python, the interpreter is just like a Virtual Machine (written in C) which executes the Python statements. This doesnt convert Python code to C code In Cython, Python code is converted to C code using a Python code generator in between and then compiled into an executable or a library.
DEV 7
https://www.hackerrank.com/challenges/c-tutorial-functions/problem
DEV 7
help