MᏫᎻᎯᎷᎷᎬᎠ
BinaryByter
Nomid Íkorni-Sciurus
hm, okay, now it's clear
MᏫᎻᎯᎷᎷᎬᎠ
BinaryByter
there is ONE interesting
Liam
In asm level, every variable is mem-address and offset.
BinaryByter
Nomid Íkorni-Sciurus
This is the kind of study I'm looking for. So, GCC + GDB should suffice right?
BinaryByter
MᏫᎻᎯᎷᎷᎬᎠ
BinaryByter
void a::b(int a)
is assembled to
a::b(a* this, int a)
BinaryByter
Wtf?!
Idk how gcc implements its shits
BinaryByter
is_trivial uses compiler intrinsics
BinaryByter
Meaning that it exposes you directly to the compilers implem
BinaryByter
MᏫᎻᎯᎷᎷᎬᎠ
BinaryByter
BinaryByter
it doesnt matter for my point
Liam
well, yes
Liam
my fault.
BinaryByter
The compiler could pass it in the middle
BinaryByter
Hmm maybe
Idk how gcc implements its shits
BinaryByter
Actually, from what ive read, deleted constructors seem to be defined as trivial
BinaryByter
Oh well
BinaryByter
in practice, this is kinda useless to know
BinaryByter
so 🤷♂
Nomid Íkorni-Sciurus
BinaryByter
this group gives me agressions xD
Nomid Íkorni-Sciurus
MᏫᎻᎯᎷᎷᎬᎠ
Okay
Another question
If trivial class is a class that a has a defaulted special member functions
Then why there is __is_trivial_copyable(T) built-in function
The copy constructor is already there in the ordinary trivial class
MᏫᎻᎯᎷᎷᎬᎠ
Is there a class that doesn't has a copy constructor and trivial at the same time?!
Liam
Headache...
A class type is trivial if it's trivially_copyable and it's trivially default constructivle. The later requires the class type has one or more default constructors, all of which are either trivial or deleted, and at least one of which is not deleted.
So...
struct A {
A() = delete;
};
is not trivial. however, both gcc and clang give true for std::is_trivial<A>::value.
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
Like
If you deleted one
Another one will be provided?!
Liam
It seems that the committee is aware of this problem.
> A default constructor that is defined as deleted is trivial, according to 12.1 [class.ctor] paragraph 5. This means that, according to 9 [class] paragraph 6, such a class can be trivial. If, however, the class has no default constructor because it has a user-declared constructor, the class is not trivial. Since both cases prevent default construction of the class, it is not clear why there is a difference in triviality between the cases.
Liam
Nomid Íkorni-Sciurus
Hm, I find GCC's assembly output to be less clear than MSVC's
Liam
and also Clang's.
Nomid Íkorni-Sciurus
Nomid Íkorni-Sciurus
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
Thanks
Anonymous
Hi
MᏫᎻᎯᎷᎷᎬᎠ
Hi
بوصَعبْ
Anonymous
Hello
Anonymous
hey guys, how can i save long words in one single char or variable??
Ex:-
char ch;
cin >> ch; /*here i want to enter long words like (my name is ... *\
Anonymous
I've google it, but no good result
Liam
#include <string>
int main() {
std::string s;
std::cin >> s;
std::cout << s << std::endl;
return 0;
}
Anonymous
Thanks bro
joel
joel
what's it
joel
interesting
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
Lemme check it
MᏫᎻᎯᎷᎷᎬᎠ
Lmao It's blocked from my country xD
Anonymous
MᏫᎻᎯᎷᎷᎬᎠ
Yeah
Anonymous
Yeah
Ur from the Middle East den?
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
East Africa
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
hey
MᏫᎻᎯᎷᎷᎬᎠ
we can't bind a cosnt lvalue reference to a bare rvalue right?
MᏫᎻᎯᎷᎷᎬᎠ
for example
this is not valid
const int& r = 1;
int&& r1 = std::move(r);
MᏫᎻᎯᎷᎷᎬᎠ
but
in std::move implementation
it's parameter is
move(_Tp&& t)
notice that if you pass "r"(which is const lvalue reference) is legal
MᏫᎻᎯᎷᎷᎬᎠ
why?
BinaryByter
The compiler is not as strongly, typed as you may think
BinaryByter
BinaryByter
works