Mar!o
Seriously?
Yeah - maybe I'll find a good example
Anonymous
Anonymous
Will I have to understand machine code to work out certain high level bugs or is C++ sufficient?
Mar!o
Seriously?
There is generally a huge difference in interpreted languages (scripting) (JS, Python) and AOT compiled languages like C, C++ or Rust there even is something in between like java or C#
Anonymous
I will get it soon enough hopefully
Mar!o
Will I have to understand machine code to work out certain high level bugs or is C++ sufficient?
No. There also is a difference between assembly and machine code. Machine code is just a byte array filled with instructions and data. Assembly is like a human understandable text version of that. An assembler "compiles" these text instructions into machine code. Understanding assembly will help with some bugs and optimization but is not necessary. It's more important that you understand the C++ concepts. Knowing machine code is needed for three major things: 1. Hacking (reverse engineering) 2. Building compilers, assemblers 3. Building CPUs
Mar!o
I will get it soon enough hopefully
Sure you will just try out different languages
Mar!o
Guess machine code won't do anyone much good then unless they're a software engineer or something
No - raw machine code bytes are not used often today. Assembly sometimes: movq %rbp, %rsp but not the machine code: 0x48 0x89 0xe5
Anonymous
Well good bye
Stefano
can you help me?: https://pastebin.com/9MzPRS3a
Stefano
I have to realize the function I wrote at the bottom
Tahmedur
Hi what kind of problem is that in vs code 'ISO C++ Forbides converting a string constant to char*'
Anonymous
So what is the difference between ~ and ! operators?
Pavel
So what is the difference between ~ and ! operators?
! is logical operator, ~ is bitwise First applies to bool and returns bool, the second applies to integers and returns integer (if I recall correctly). Try std::cout << (~5); and std::cout << (~(~5));
Precious M
Please I need developer assistance in a custom php project
Diego
Php would be off topic in this group, sorry Try to find a php group like you found this one
MAC
🌳 PHP @phpgeeks @phpgeeksjunior @phpclubru @prophp7 @codeidua 🌿 Laravel @laravel_pro @laravelrus 🌿 Yii @yii1ru @yii2ru @yii3ru 🌿 Symfony @symfony_php @symfony_ru 👨🏼‍💻 Работа @php_jobs @yiijobs
MAC
Thanks
Or here
AHMED
any arr[]={5, 3.2, "awesome"};
AHMED
Is the above code valid?
AHMED
If so, how to access arr[0];
AHMED
What is it ?
Array of type any to hold variables of different types. DOES it exist?
MAC
Array of type any to hold variables of different types. DOES it exist?
There aren't in pure c/c++, but you can create or use a library
AHMED
And is there a container to hold values of different types?
MAC
Can u help me how?
You can create struct and after create array of it
MAC
And is there a container to hold values of different types?
#include <iostream> using namespace std; struct { //all types you need int a; double c; }array; int main(int argc, char *argv[]) { array myarray[size]; }
robherc
Hello, I'm writing functions to perform binary roll operations on different sized integers in C. Right now, I'm working with 8-bit variables (uint8_t/unsigned char) and I can successfully RoL from 0-8 positions, but for positions 9-31 (yes, I've tried modulo-dividing by 8nfor the shift distances, but get the same results) I'm encountering errors I can't figure out in testing (RoR only works on positions 24-32). Is anyone willing/able to help me with this?
robherc
Array of type any to hold variables of different types. DOES it exist?
You could use an array of pointers; then just "load" the array with pointers to variables of whatever type you need. ...then your next problem becomes reading the data back out of the array. You'll have to have some way of knowing what type of data each pointer is "pointing" to. (Something similar to how "printf" works in C may be applicable here)
Asad
If so, how to access arr[0];
Here is the C++ example: #include <any> #include <iostream> int main() { std::any arr[] = { 5, 3.2, std::string("awesome") }; std::cout << std::any_cast<int> (arr[0]) << std::endl; std::cout << std::any_cast<double> (arr[1]) << std::endl; std::cout << std::any_cast<std::string> (arr[2]) << std::endl; return 0; }
Rubens
Good evening everyone I am developing a project, in which, via GPS location, with a Compass Arduino module. Toy car can move inside a house just by pre-programming its movement, I've been researching for a while on ways to do this, I thought about doing a Path planning, but I don't know if I can do it on Arduino or esp32. Can someone help me ? I'm doing this project for a competition, if someone can help me or give me a tip I will thank you very much. I don't have much knowledge of the area, but I'm looking forward to seeing this project working. Thank you very much in advance
Asad
AHMED Here is the C version: https://pastebin.com/SkddSwPS
Aakash
Hi what kind of problem is that in vs code 'ISO C++ Forbides converting a string constant to char*'
#include <iostream> #include <string> int main() { { /////__problem__ std::string strXX = "good string-XX.."; char const *chrXX = strXX.c_str(); strXX = "bad string-XX.."; std::cout <<"\n" << chrXX; } { /////__problem-fix__ std::string strYY = "good string-YY"; auto const chrYY = [strYY]()->char* { return (char*)strYY.c_str(); }; strYY = "bad string-YY.."; std::cout <<"\n" << (char *)&chrYY; } return 0; } 🙃
Anonymous
Gabo Islas: Algún canal o documentación para estudiar análisis de algoritmos desde la teoría? Escucho sus respuestas Saludos
Anonymous
Any channel or documentation to study algorithm analysis from theory? I listen to your responses Greetings
Anonymous
Ok thanks you
Anonymous
Thanks
AHMED
Just use a std::tuple lol
I want to play with the features 😊
Mar!o
I want to play with the features 😊
Sure 😊 and if you write C and don't have std::tuple write a discriminated union
Pavel
I want to play with the features 😊
std::variant is another way
Mar!o
There aren't in pure C or C++
Sure there are take a look at std::tuple or std::variant...
Asad
Never do that
Is there any other way
Mar!o
Is there any other way
discriminated union
Mar!o
the idea is: enum Type { Int = 0, Float = 1, Ptr = 2 }; struct Entry { union { int i; float f; void* p; } values; enum Type type; };
Asad
Looks good to me
Anonymous
Is there any other way
https://github.com/Hirrolot/datatype99
Mar!o
https://github.com/Hirrolot/datatype99
That's great reminds me of Rust :)
Mar!o
Looks good to me
But only for C in C++ use tuple or variant
Asad
But only for C in C++ use tuple or variant
Of course. I thought about an array of std::any, but, std::tuple have just better syntax 👍
MᏫᎻᎯᎷᎷᎬᎠ
.
Asad
What is the purpose of std::any?
Anonymous
Asad
Just answer
Asad
It is to hold any type of data. So, what is so funny?
Aakash
It is to hold any type of data. So, what is so funny?
Take it easy! ..eagles. Here’s the poetic explanation to your concern.. Thy work by Char* is to Std:String, Int* is to Std:Vector, Or, C is to C++, Thy love remains for.. Void * is to Std:Any 🙃
Anonymous
std::string is a more advanced char pointer, similar to String in java, and all String Literals in C++ are automatically assignable/convertable to std::string (i think) const char * literal = "string literal"; std::string literal = "string literal"; std::string string = std::string("string literal"); std::vector is basically a linked list implementation in C, except WAY more complete, and automatically expandable undernieth it uses a normal C pointer which is publically accessable vis the data member // vector with 5 elements, still resizable std::vector<int> intVector = std::vector<int>(5); // array with 5 elements int intArray[5];