Naiko
https://pastebin.com/VmFY7nMp
Anonymous
https://pastebin.com/VmFY7nMp
CFLAGS still has a -c
Thanveer
What is type conversion in c++
Anonymous
is there any good article on understanding Pointers in C I have searched a lot on this lately but can't find anything which contains everything :) if you know any website or article them please share with me thank you
Anonymous
Hi! Apart from shift operators used in IO, are bitwise operators (very) useful? I was reading about it and it seems bewildering for me.
the overloaded operators can be useful. as for the original bitwise operators, they are pretty usecase specific. useful when you are working with microcontrollers, writing some highly optimised implementation of some algorithms. writing stuff related to number theory and cryptography, etc.
Pavel
Exactly
Xor is often used for hashing, e.g. for combining two hashes into one. And&or used for implementing bitsets (e.g. bitsets based on enum), or for packing/unpacking data into ints. Never used bitwise not in my life to be honest. There are also some very specific algorithms and structures that use bitwise operations, e.g. bloom filter.
Joselu
Guys, i came from java Intellij to visual studio and i want to install the mqtt paho library, any suggestions about package managers like maven or similar to VS?
Diego
https://vcpkg.io/en/index.html
Abhi
/get cbook
Pour
Hello 👋, newbie c/cpp programmer here Nice to meet y‘all
Anonymous
Bro if there is a compiler error Whose fault is this mine or compiler?
klimi
Bro if there is a compiler error Whose fault is this mine or compiler?
depends on the error, but in 99 % it's your fault
Good
I am trying to understand POD types, I have a class with string is considered as POD datatype?
Good
ok only plain datatypes I can considered as a POD?
Anonymous
ok only plain datatypes I can considered as a POD?
POD types are those types which are both trivial (meaning trivially copyable and have a trivial default constructor) and have a standard layout. Basically PODs are those class types objects of which can be copied using memcpy and objects of which you can safely pass from C++ to C code or even .NET code.
Good
ok understood, in simple terms its same as C structures
klimi
mate, wrong group
Anonymous
ok understood, in simple terms its same as C structures
Doesnt mean that you have to define them the way you would exactly define them in C. C++ Standard gives you some leeway. You can even use access specifiers like public and private, and there are some restrictions related to base classes and stuff none of which is possible in C. But there are some guarantees as well. You can look up definitions for trivial classes and standard layout classes in the standard to understand what they are.
VENUJAN
#include <stdio.h> int main(){ float t=3.0; const g = 10; float D = 1/2*g*t*t; printf("Distance is %f",D); return 0; }
VENUJAN
why i couldnt get expected output? what's wrong?
VENUJAN
got output : Distance is 0.000000 -------------------------------- Process exited after 1.008 seconds with return value 0 Press any key to continue . . .
Anonymous
How to send a program here ??
Anonymous
Copy and paste ??
klimi
How to send a program here ??
if it is longer program please, use pasting service like dpaste, pastebin, github gist or similar
VENUJAN
Change 1/2 to (float)1/2
thanks. i got it , 0.5 instead of 1/2
class Person(Skills): name = str("Ankush Bhagat")
ㅤㅤㅤㅤㅤㅤㅤ
Naman
I want to start learning coding c++ ,if anyone can help me
Saddam
ㅤㅤㅤㅤㅤㅤㅤ
Why goto used for??
Parra
Maksim
why i couldnt get expected output? what's wrong?
when you div int/int you will get int value. you should type cast any value to double. Don't use float!!! basically compiler cast float to double any way
Maksim
this is deprecated type
Anonymous
when you div int/int you will get int value. you should type cast any value to double. Don't use float!!! basically compiler cast float to double any way
This is not true. Compiler will convert a float to a double only in mixed type operations. Not always. And who told you that float is a deprecated type?
Cris
std::cout << "type is: " << typeid(13.0f/2).name(); will print type is: f f stands for float
Vlad
this is deprecated type
float is a deprecated type? What?
Vlad
I'll go tell folks that they should ditch their vec4"s cause they've got floats in them
Maksim
32 bit for float type is not enough
Vlad
Basically all the graphics is done in single precision floats
Vlad
True, AI often too
AI sometimes in fp16 and even int8
Mar!o
AI sometimes in fp16 and even int8
Yeah they need as much vectorization as possible I do not work with Python AI frameworks (only C++) and I wonder how they handle all these types in Python... must be pretty ugly
José Manuel
If the extra precision is not needed using double it's slower and a waste of memory
Vlad
It's just that the caching is a lot better with floats
Vlad
Also vector operations
Vlad
So 1.0 + 2.0 or 1.0 + 2.0f would be the same in speed
Vlad
But if you crunch a lot of numbers or use simd those gains add up
Mar!o
Yeah for scalar values it does not really matter. But with SSE you can calculate four single precision values at once and only two double. AVX -> 8 float, 4 double AVX 512 -> 16 float, 8 double
Anonymous
Yeah they need as much vectorization as possible I do not work with Python AI frameworks (only C++) and I wonder how they handle all these types in Python... must be pretty ugly
Actually all the AI frameworks in Python are developed using cython. The types are similar to what C has and the performance is good too.
Tushar Sharma
Is there anyone can help me out with how to get better at competitive programming
Mar!o
Actually all the AI frameworks in Python are developed using cython. The types are similar to what C has and the performance is good too.
Yeah but Python itself is dynamically types so I wonder how they handle for example half precision floats? Are they converted to Python doubles when done?
Vlad
jk
class Person(Skills): name = str("Ankush Bhagat")
#include <stdio.h> #include <unistd.h> #include <sys/types.h> int main(void) { long pid=getppid(); printf("%ld %ld", (long)getpid(), pid); return 0; } Question : /proc/<ppid>/comm how to print this file with fopen
Anonymous
https://code.sololearn.com/cPu8tjFA5s3E/?ref=app
Anonymous
Can anyone tell me my coding should make changes/not ❓
Anonymous
#include <stdio.h> #include <unistd.h> #include <sys/types.h> int main(void) { long pid=getppid(); printf("%ld %ld", (long)getpid(), pid); return 0; } Question : /proc/<ppid>/comm how to print this file with fopen
You can use /proc/self/comm instead of getting pid. If you must do it using the pid number, then you must convert it to a string representation and then use strncat to generate the filename
Anonymous
recursion <-> permutations PS: next_permutation can be used but only when you understand the basic stuff
Anonymous
you are finding all the possible choices - CHOICES ==> RECURSION
Anonymous
Learn how recursion works Form a mathematical function, and use it as a recurrence
Anonymous
why  !(1 && !(0 || 1)) comes out to be true "1"
Vlad
You negate it. It becomes 0
Vlad
1 && 0 is 0. Then you negate it again