Mihail
I regret seeing that
BinaryByter
I regret seeing that
wait until you see operator() madness :^)
BinaryByter
myFunctor ()()()()()()()()()()()()()()()()()()()();
BinaryByter
:D
Mihail
BinaryByter
I love abusing C++ tho
olli
@ollirz am I right about that?
Yes, ++i/++i should be UB
BinaryByter
Yes, ++i/++i should be UB
while ++i + ++i isn't
Mark
Guys... I'm currently working with 'c in depth' book... Is this a good start for me as a beginner.
BinaryByter
C is an old language
BinaryByter
You should learn C++ first
BinaryByter
and learn C later if you really need to
olli
while ++i + ++i isn't
Well I consider it UB as well, although you probably gonna see the same result in every compiler. Left or right side first?
Mark
You should learn C++ first
So should i start learning c++ first... Ok any suggestions about sources books anything.
Mark
That'll be great
BinaryByter
effective c++ is very good
BinaryByter
"effective C++"
BinaryByter
or the "C++ primer"
olli
doesnt matter since addition is commutative, or am I wrong?
That's why I would expect to see the same result everywhere although technically UB...
Mark
That's it...
BinaryByter
why is it?
Mark
or the "C++ primer"
Thank you admin for enlightening my way...
BinaryByter
sure
Mark
👍👍
MᏫᎻᎯᎷᎷᎬᎠ
Hmm
olli
"technically UB"?
because the + operator does not define a sequence point. So the side effect is unsequenced relative to the value computation yielding UB
BinaryByter
else every op would be UB
BinaryByter
and every funciton call before cxx17
Anonymous
The output is b because the printf() functions stores its argument in stack from left yo right.. And thus the last ++i is executed first and is value is printed at position of 2nd %d specifier
olli
just "Undefined sequence of operation" doesnt make UB
it does if there are side effects. ++ is a side effect http://eel.is/c++draft/intro.execution#10
olli
just "Undefined sequence of operation" doesnt make UB
What's the result? struct Foo { int x; friend Foo operator + (Foo a, Foo b) { return { a.x / b.x }; }; Foo& operator++() { ++this->x; return *this; } }; int bar() { Foo f1{1}; Foo f = ++f1 + ++f1; return f.x; }
BinaryByter
oh THATS why its undefined
BinaryByter
I see
Anonymous
Guys how to write a c function to add two fractions using structure and integer as data types
BinaryByter
We won't code for you
BinaryByter
Instead, ask more specific questions
Anonymous
BinaryByter
there is no concept that makes that problem different
Anonymous
Can u ellobrate how to do I not getting it so
Anonymous
Plz
BinaryByter
no, ask a specific question
BinaryByter
help me with helping you
Anonymous
- get the same denominator - add them
But answer should be fraction
BinaryByter
Anonymous
Oh. Got it 👍 thx
Anonymous
Anonymous
Hi
Anonymous
Anonymous
@admins
Anonymous
So nice 😍
Anonymous
/warns
Was removed
i am new to C++... ai using codeblocks...but it doesn't seem to recognise the #include <iostream> or #include <iostream.h> directives....is it an issue that can be resolved or i just switch to another IDE?
Dima
Lol
Anonymous
hi
Pavel
Can I make a variadic that process elements of different type than the given ones? Something like this: template<typename... Args> std::tuple<Args...> getValues(const std::tuple<std::vector<Args>&...>& containers) { ... } But I want my input parameter to be typle of std::vector<BaseClass>...>& for any given types E.g. if I use <int, float> as template arguments, I want the signature to be std::tuple<int, float> getValues(std::tuple<std::vector<BaseClass>&, std::vector<BaseClass>&>& containers) But not std::tuple<int, float> getValues(std::tuple<std::vector<int>&, std::vector<float>&>& containers) as it now. How I can achieve that?
MᏫᎻᎯᎷᎷᎬᎠ
Wow creepy name
Pavel
Are you sure that's the only way? Because it looks unreadable
It's a simplified version. The real one looks not readable at all :) I don't see better way than templates to achieve that I want. all the implementations that I saw made on templates
Pavel
I'll refactor it later, for now I want it to work as I expect
Pavel
Trust me, you won't be able to read it in the future
Yes, but that doesn't matter in this case, I do it for educational purposes. I can't afford to make a good-looking scalable and readable solution to throw it away right after that. I want to shoot my leg enough times to be aware of what I should or shouldn't do. And now I can't load my revolver to do another try :)
📕Editar📘
Hola a Todos
📕Editar📘
😊👍
klimi
Hola a Todos
This is English group
📕Editar📘
This is English group
Hi people. What's up people !
AY
Hello
AY
How are you programmers✋
AY
Any one have a problem in programming i can help him 😁
AY
Oh sry i have a very nice course in computer security and i will send the download link from mega😞