Igor🇺🇦
Is there any way in which we get from structure hello to some type of data that holds a reference to the class name in a C string?
Is my understanding correct - you want to print type name. In C++ you use typeid for that https://en.cppreference.com/w/cpp/language/typeid In C there is no generic way.
Anonymous
Can i know how to display data in mini project
Igor🇺🇦
I have to pass class name (structure) into a string pointer
There are no string pointers in C. Only char*
Anonymous
Ok
Anonymous
Am beginner please guys can any one teach me c++
Igor🇺🇦
char**
There is no string in C. char** is a pointer to char*, not string.
Igor🇺🇦
Am beginner please guys can any one teach me c++
There plenty of tutorials on the Internet.
mov $22, %rax
char* can hold a string of charachters
Anonymous
Ok who will teach me please
mov $22, %rax
that's what a string is
Igor🇺🇦
that's what a string is
char* just points to some data. It can be an array of characters without \0 and none of the str methods will work correctly. Or it can point to some random data that was casted to char*. It's not like C++ string that "knows" what it contains and were it ends.
Anonymous
Ok who will teach me please
A better way to learn any prog language is by writing the program, Start to code, compile & run, debug, compile and run again..... 🙂
Diego
Ok who will teach me please
If you're really interested you could hit me up
Anonymous
Ok 👌 i dm you
Anonymous
Int main(){ Printf(" can bot ban people automatically?"); Return o; }
Hanz
Int main(){ Printf(" can bot ban people automatically?"); Return o; }
No because your main returns variable o. Anyway that is offtopic
Nisal
I just need some explanation anyway thanks for your explanation @kyoko687 and sorry for disturbing you @K11M1 if you dont like to help you can ignore
Nisal
Anonymous
Is there any changes or meaning change?
Georges
Hello, i need to implement a parallel multithreaded version function to check if the input is a palindrome in c++
Vlad
Your strings must be ridiculously long if you consider doing that in parallel. So long in fact that they are probably almost never a palindrome
Georges
Yeah but i need to do it
Vlad
Split a half of an array into parts
Vlad
Give to different threads
Vlad
Make an array of bool of results
Vlad
Whether that part was a palindrome or not
Vlad
Then check that all elements are true in the main thread
Vlad
Or you may use atomic<bool> but it might be slower
Georges
No i don’t want it slower
Georges
I got the idea thank you
Vlad
No i don’t want it slower
"might" be
Vlad
It may actually be faster depending on the input
Georges
Oh okay
Diego
No i don’t want it slower
Sometimes slower is safer You always need to weigh it out but slower > deadlock prone
Diego
Or worse still, data corrupting prone; since at least deadlocks are easy to diagnose
Vlad
Sometimes slower is safer You always need to weigh it out but slower > deadlock prone
My original solution is totally safe. It's just that if any thread finds out non palindrome part other will still continue looking in their part
Georges
I understood thanks guys
Suraj
Hi friends
Amohelang
MR᭄HACKER࿐
Hlo
Georges
Hello, i need to implement a parallel multithreaded version of inner_product which computes the dot product of two ranges in c++
Vlad
You mean 2d vectors?
Georges
Yes
Vlad
Well vector has 2 members. X and Y
Vlad
What are you gonna parallelise?
Georges
Here i am using two 1D vectors, not a 2d vector
Igor🇺🇦
Hello, i need to implement a parallel multithreaded version of inner_product which computes the dot product of two ranges in c++
Isn't it already implemented : https://en.cppreference.com/w/cpp/algorithm/transform_reduce?
Vlad
Here i am using two 1D vectors, not a 2d vector
So let's get the confusion out of the way. You use std::vector
Vlad
Not the math vector
Georges
Yeah
Vlad
Yeah
So. Dot product is calculated using two-component math vector
Georges
True
Vlad
The thing is. They are unrelated :P
yd
Hello everyone, I got a C program and it worked well on Linux. However, I found it was extremely slow on windows ( I used MinGW to build for windows).
yd
Would anyone teach me how to fix the issue? Thanks .
Vlad
Profile the program on windows
Georges
The signature of the function that i should use is the following: template <typename Iterator> double inner_par(Iterator first1, Iterator last1, Iterator first2, Iterator last2) { return 0; }
Vlad
So you'd at least know where it's slow
yd
I only used the c89 stand library.
Vlad
I only used the c89 stand library.
You used posix, amirite?
yd
I guessed that maybe one of the three reasons: Malloc, fopen, math .
yd
I did not used posix. The program did some scientific computation.
yd
It is like grab some data from a csv file and compute something and then fputs to a new csv file.
yd
Loop file write/read many times.
Vlad
Also make sure that optimization flags and all of that are the same
Vlad
You could be comparing debug with release
Vlad
And of course debug would be slower