Anonymous
cant paste the link here for reference but u can google c++17 fold expression and variadic template arguments. im not sure about the type unpacking tho
BinaryByter
std::string getPostData () { std::string postData; std::string temp; while (std::getline(std::cin, temp).good()) postData += temp + "\n"; return postData; }
BinaryByter
does anybody have an idea why this fails?
MᏫᎻᎯᎷᎷᎬᎠ
What is the termination character?
Annie
hello
MᏫᎻᎯᎷᎷᎬᎠ
What is the termination character?
Cuz you'll stuck in a while loop forever
MᏫᎻᎯᎷᎷᎬᎠ
hello
Hello
MᏫᎻᎯᎷᎷᎬᎠ
Ctrl+C will terminate the program
MᏫᎻᎯᎷᎷᎬᎠ
Not the loop
Dima
Lol! Look at his bio!
Dima
/ban @madhackcrypto Bye
Ariana
LOL
BinaryByter
my CGI server doesnt tell me ;_;
BinaryByter
when I use while(cin.good()) it works
BinaryByter
/warn @testerz swastika in name
Francisco
Yo can omit the .good(), as istreams can be converte to bool
T
Sorry bymistake sent voice note
BinaryByter
Dima
indian flag in a name
BinaryByter
you better remove that quickly
T
/warn @testerz swastika in name
Its holy symbol in Hinduism.swastika with dot.
BinaryByter
🤔
BinaryByter
poor indians
Dima
Francisco
yes, but I sent that for clarity
But it doesn't work like that?
BinaryByter
࿗ ࿕ corporate wants you to find the difference between those two pictures - they are the same picture
Francisco
wat?
Try the fail bit
BinaryByter
you mean with eof?
BinaryByter
but I am using getline
BinaryByter
i cannot control the fail bit of cin
Francisco
but I am using getline
But getline returns an istream, so you can do while(!std::getline(std::cin, temp).fail()), which is basically doing while(std::getline(std::cin, temp))
Francisco
https://en.cppreference.com/w/cpp/memory/unique_ptr
Francisco
There you have all you need
Francisco
And no, you can't
松鼠
Excuse me, I want to know why printf("%d\n", 5.03); will give me 1374389535 ? What is printf("%d") operate on the double number? (P.S. My English is very poor, sorry😅
Mihail
5.03 isn't one
松鼠
It's %f, not %d
I know that, but I got a question about this code, and I want to know how it become to this strange integer
Mihail
Google "IEEE 754"
BinaryByter
BinaryByter
for now accept how it is
松鼠
Google "IEEE 754"
So, it just convert floating point form to integer directly?
BinaryByter
it takes the data
BinaryByter
and acts like its an int
Francisco
So, it just convert floating point form to integer directly?
The same bits can represent very different numbers in floats and integers
松鼠
Oh, yes, I meant operate without moving decimal point
松鼠
Is my thought correct ?
BinaryByter
Why?
enjoy teaching someone who barely knows printf how bits work and how the processor internally works with floats :D
松鼠
Uhh.. I know how to output integer correctly, but my question is about output double by using printf("%d"),so I want to know whether computer just use the data which is floating-point number in IEEE754 , and operate it with the way in integer.
Anonymous
doesnt*
Anonymous
if you use a different compiler it should give u a different output
Francisco
Uhh.. I know how to output integer correctly, but my question is about output double by using printf("%d"),so I want to know whether computer just use the data which is floating-point number in IEEE754 , and operate it with the way in integer.
Imagine two 32-bit sequences. An integral representation will give them an integral value, and a floating-point representation will give them a floating-point one (they normally aren't even close to be equal). If you tell printf to read some variable as an integer, it will do it by using the bits, not the actual value. If the variable happens to be a floating-point number, its value doesn't have to match the integral representation
Francisco
5.03 == 01000000101000001111010111000011 == 1084290499 which is not the same as 1374389535
It's undefined behaviour in the end, so don't look for an explanation
BinaryByter
which would be another result
松鼠
Oh.. UB.. I see Thanks you all very much🙇‍♂️
Anonymous
which would be another result
if he use a different compiler, it is also a different result because its undefined behavior
klimi
Kunal
Anyone out there worked on Devops for c++ on a real project?
Talula
Anyone out there worked on Devops for c++ on a real project?
Yeah but long long ago when flowers hadn't evolved yet.
Mat
https://stackoverflow.com/questions/40450711/use-of-d-inside-printf-to-print-float-value-gives-unexpected-output
Anonymous
Hi
Anonymous
How are you guys
MᏫᎻᎯᎷᎷᎬᎠ
How are you guys
We're fine
BinaryByter
/ban no comment
Dima
/ban @JohnTheProgrammer
Dima
just for sure..
Stefan
Nice queen reference
Anonymous
🤔
MᏫᎻᎯᎷᎷᎬᎠ
Hi