Danya🔥
Concepts. std::is_base_of
https://en.cppreference.com/w/cpp/language/constraints
Danya🔥
Concepts. std::is_base_of
This is not a concept https://en.cppreference.com/w/cpp/concepts/derived_from
Anonymous
This is not a concept https://en.cppreference.com/w/cpp/concepts/derived_from
derived_from uses std::is_base_of. The idea was to tell him what the equivalent in C++ is and how to build such a constraint
Danya🔥
derived_from uses std::is_base_of. The idea was to tell him what the equivalent in C++ is and how to build such a constraint
I don't think it's a great idea Because you can use a type trait in the requires clause anyway but it'll be worse in the long run because of constraint subsumption
Danya🔥
If they want, they can learn how to make concepts themselves
Anonymous
I don't think it's a great idea Because you can use a type trait in the requires clause anyway but it'll be worse in the long run because of constraint subsumption
Yes. Using derived_from is the right way. I didn't suggest that he should use is_base_of and not derived_from. The question was : is there an equivalent of constraints in C++? The answer to that was concepts which is applicable since C++20. If he is not using C++20, then std::is_base_of trait is a good enough alternative. Now assuming he builds a concept from std::is_base_of, you are right that derived_from and this new concept that he developed will be equivalent and this will be a problem and can lead to ambiguity like you said. Again, I am not suggesting that he should not use derived_from. Clearly that is the best idea if he is using C++20. My suggestion was to use the trait if he is not familiar with concepts or if he is not using C++20 which many of us still aren't.
Danya🔥
/unmute @ancientgc
Tia
Hey everyone! I am new to C. I recently had my first interview and I failed it but I have screenshots question can anybody help me to find the solutions?
𝔖𝔞𝔯𝔬
𝔖𝔞𝔯𝔬
I Want compile errors when I attend to use a type in the template wich doesn’t inerehit from a certain class
Michel
by explicitly mention it? auto something = std::make_pair<int, float>(0, .0).first;
Well, yes, that's an option, but I was wondering if something like _ existed. The _ makes it more explicit that there is something there I don't care for and also in a tuple with more than two elements will save some characters of code. Thanks anyways for your comment.
Anonymous
#include "stdio.h" using namespace std; int main{ return 0; }
Anonymous
Can anyone send me the link for c++ free books
Danya🔥
Anonymous
😂😂😂
shriman_deepak
So what?
No output
IDCAN
How can i inline assembly code into my C++ code. I'm using cmake and MSVC 19.34.31942.0 compiler?
IDCAN
Does MSVC 19.34.31942.0 compiler support inline assembly code for build x64 architecture?
Anonymous
How can i inline assembly code into my C++ code. I'm using cmake and MSVC 19.34.31942.0 compiler?
https://stackoverflow.com/questions/41208105/making-assembly-function-inline-in-x64-visual-studio
🥀
Any ideas for c langauge project?
Anonymous
✋ Hi, I have the exercise: Create a program that contains a float array containing 3 rows and 3 columns.Print the address of each position in this matrix. This my solution: for(int i = 0;i < 3;i++){ for(int j = 0;j < 3;j++){ std::cout<<(number+i)+j<<" "; } std::cout<<"\n";} OUTPUT-> 0x7afdf0 0x7afdfc 0x7afe080x7afdfc 0x7afe08 0x7afe14 0x7afe08 0x7afe20 0x7afe20
Anonymous
In positions 0.1 and 1.0 have the same address as well as 0.2 and 1.2 and 2.0 why is my code wrong? If you are someone who will please explain to me why I don't understand why this return.
Ziky
(number+i)+j
Ziky
because of this I guess try &(number[i][j])
Anonymous
One more question reading an array through pointer armath could be like this? std::cin>>*(n+i);
Nothing
include <stdio.h> int add(int num1, int num2) { printf("\n%d", num1+num2); Should i write int or void The question was 1) Write a program that declares a pointer to a function that takes two integers as arguments and returns an integer. The program should then use the pointer to call the function with two integers and print the result.
Nothing
Int add or Void add
Sathiiii💜🧿
include <stdio.h> int add(int num1, int num2) { printf("\n%d", num1+num2); Should i write int or void The question was 1) Write a program that declares a pointer to a function that takes two integers as arguments and returns an integer. The program should then use the pointer to call the function with two integers and print the result.
Hi, Based on this program , it seems like you want to print the result of the addition operation in the add function. If that's the case, then you should use the void keyword as the return type of the add function, since you are not returning anything from the function. if you are declaring a pointer to a function that takes two integers as arguments and returns an integer, then you should use the int keyword as the return type.
DaviChan
DaviChan
and can be as easy or complex as you want
Christian
hello, anyone here have experience interfacing from c++ client (uWebSockets) to Flask-SocketIO server? Or know if it is even possible.
Anonymous
I’m new in C++ any expert should me with assignments
Guillermo
If you want assignents, look at Project Euler :)
Ya deway
Hi all I'm having some problem with pointers in C (again)... I use this function to split only the first substring that ends with "\r\n\r\n" (there are more than one, I would like extract data starting from the string and ending at the first match). I use the following function but I get Segmentation Fault (core dumped) https://pastebin.com/XvGnMjtJ
Danya🔥
First of all for (i = 0; i < input_length - 3; i++) { This should be - 4
Danya🔥
Second of all in the second loop you go beyond strlen of the string
Danya🔥
You should just use C++
Ya deway
First of all for (i = 0; i < input_length - 3; i++) { This should be - 4
Thanks for correction but with regard to second point why i exit the strlen? This condition in my for loop isn't correct? && i < input_length;
Ya deway
Damn, u right lol
Anonymous
what is data memory allocation,?
Danya🔥
Sleeves
Hey people, say you have a value you want hardcoded into your program (exe), in the program , the value is fed as part of a powershell script that will be base64 encoded. How can I do this ? The value is to be collected from users and the exe must be compiled with the value.
Prinzkyd
Any ideas for c langauge project?
Pick any project and use c to solve it
Sleeves
Sleeves
assign it ?
Prinzkyd
Sleeves
Yh
can u maybe send a resource or link. I have no idea what u mean by that
Prinzkyd
Ok I'm coming
Prinzkyd
can u maybe send a resource or link. I have no idea what u mean by that
#include <iostream> using namespace std; int main() { int x= 6; std::cout << "Hello World!\n"; cout<<"Prince is here now"<<endl; cout<<"Number is :"<<x<<endl; return 0; }
Guillermo
Where can I get that
Projecteuler.net?
Tokin
Any ideas for c langauge project?
Design and implement your own kernel using C
Tokin
Is this what portable executable is?
Ziky
I guess you probably have to write your own compiler
Maybe not. You can overwite right bytes in your binary from outside.
Tokin
So by using binary patcher or hex editor you gotta change the right bytes under data section of the .exe? Hm
Pavel
So by using binary patcher or hex editor you gotta change the right bytes under data section of the .exe? Hm
I wonder if windows defender can block such script, because it sounds suspicious to edit exe files But in theory that can work
Tokin
It probably wont block if its cert signed and your cert got reputation
Ziky
So by using binary patcher or hex editor you gotta change the right bytes under data section of the .exe? Hm
In fact this approach is currently used in automotive for parametrization of binaries going to various ECUs. But of course on regular computers, configuration file is way better option.
Brixn
Anyone to debug c code form me just 3errors
klimi
yes
Ya deway
hello everyone today I am facing another string problem, . I have a pointer to a string to modify, i.e. I have to insert another string in a certain position and keep the rest unchanged. The string is made up of many \r\n, I'm using a function that is effective only in certain situations. Can anyone explain the following function to me better and why Is not working well ? https://pastebin.com/39invi7c? (It print only the start to the injected string, not the rest). Thanks again for all Ur support
Ya deway
hello everyone today I am facing another string problem, . I have a pointer to a string to modify, i.e. I have to insert another string in a certain position and keep the rest unchanged. The string is made up of many \r\n, I'm using a function that is effective only in certain situations. Can anyone explain the following function to me better and why Is not working well ? https://pastebin.com/39invi7c? (It print only the start to the injected string, not the rest). Thanks again for all Ur support
The problem lies in the fact that the function only prints the header of the request and the custom string. The body doesn't print even though it should, I think it's all caused by the /0 string terminator, can you help me? I've checked all the variable sizes and they match with wireshark so I'm assuming it's not a calculation related issue
Ziky
new_payload[header_len + strlen(custom_head)] = '\0';