Artöm
Just pressing the run button doesn't work
Check vs code documentation for launch.json, compilation and running can be configured there
pappupanchi
Ok
.
/notes
.
/get programming books
.
/getfreeprogrammingbook
Vikas
/cbook
Vishal
Hello wonderful people, I've got into this habit of marking my APIs as noexcept. What do you guys think about this habit? Is this a good practice? Are there performance drawbacks?
Artöm
Perfomance should increase
Artöm
But keep in mind, that once you mark something noexcept, it is hard to remove it if you care about abi
Anonymous
Hii
Chirag
/get bro
Chirag
#ot
Chirag
#best
Chirag
#best-book
Chirag
#awesomeness
Chirag
#bingo
Chirag
#findprojects
Chirag
#cs50
Chirag
#goodcodingmentality
Chirag
#great
MᏫᎻᎯᎷᎷᎬᎠ
No news about C++20 release date?
MᏫᎻᎯᎷᎷᎬᎠ
Full Modules support
Nils
of which type is b when a is of type const std::vector<std::string>? auto b = a.begin();
Alex
vector<string>::const_iterator I guess
Nils
const iterator
std::iterator?
Nils
does not exist
Anonymous
Nope
that was correct
Anonymous
Hii
Cengizhan
decltype(a)::iterator
Decltype(a)::const_iterator?
Anonymous
Anonymous
All iterators of const vector are const
Walusimbi
Please help me understand in which case can this be true void main() { }
Walusimbi
So main can’t be of void
Walusimbi
No wonder I tried to compile it and it failed.
Walusimbi
Thank you.
olli
> "[The main] function [...] shall have a declared return type of type int" http://eel.is/c++draft/basic.start.main#2
olli
Okay So let's make it sizeof(T) > sizeof(T*) Isn't that okay?
but might still pass a trivial structure such as the one above by reference instead of value, whereas passing it by value might be faster
MᏫᎻᎯᎷᎷᎬᎠ
but might still pass a trivial structure such as the one above by reference instead of value, whereas passing it by value might be faster
So What do you suggest?! We sometimes just type const T& just because we don't know what type the user will pass
olli
I think one should be aware that struct Foo { char x; ~Foo() {}; }; extern void OBar(OptTypeT<Foo> foo); void OQux(OptTypeT<Foo> foo) { OBar(foo); } this would compile into OQux(Foo): sub rsp, 24 movzx eax, BYTE PTR [rdi] lea rdi, [rsp+15] mov BYTE PTR [rsp+15], al call OBar(Foo) add rsp, 24 ret
Tute
So it’s always int main()
In C++ yes, in C you can use void... but usually we use a C++ compilier
Walusimbi
Some explain to me the usage of ? And :
olli
Whereas using references extern void RBar(const Foo& foo); void RQux(const Foo& foo) { RBar(foo); } would compile into a single jmp RQux(Foo const&): jmp RBar(Foo const&)
Tute
Some explain to me the usage of ? And :
c = (exp) ? 1 : 2; // equivalent: if(exp) c = 1; else c = 2;
Anonymous
oh. oh i now i get why he did sizeof > 8
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
std::forward my dude
Not sure if it would work
olli
So basically you are saying that sometimes passing by value for small size type is slower than by reference?
There are cases where the code generated is worse (most likely due to ABI requirements imposed by the underlying platform). I would suggest to benchmark it to see the performance impact
MᏫᎻᎯᎷᎷᎬᎠ
There are platform-dependent constructs headers like cstdint
MᏫᎻᎯᎷᎷᎬᎠ
Like sometimes int is preferable to short int
MᏫᎻᎯᎷᎷᎬᎠ
Okay Now I get it Do you know why the standard doesn't do this?!
MᏫᎻᎯᎷᎷᎬᎠ
It's C++ after all You can provide ready to use utilities while the programmers feel free to make their moves
MᏫᎻᎯᎷᎷᎬᎠ
Hmmm
MᏫᎻᎯᎷᎷᎬᎠ
Fairly logical
Anonymous
/cbook
Pavel
Do you know any good naming conventions discussing naming of boolean member variables describing states. I mean class Calculator { bool finished; // 1 bool isFinished; // 2 bool hasFinished; // 3 };
Pavel
Dima
I think first matches c/c++ style better
MTG
/notes
MTG
/cbook
klimi
/cbook
/get cbook
MTG
/get cbook
Cengizhan
Do you know any good naming conventions discussing naming of boolean member variables describing states. I mean class Calculator { bool finished; // 1 bool isFinished; // 2 bool hasFinished; // 3 };
I would choose 2 and recommend that if I review the code. Boolean type used for two-state (true or false), and "finished or not" can be expressed by used term "is(VERB)" if it is the case. Sometimes, 3 can be also used such as "has(THING)" like hasKey, hasNode etc. it depends on the context.
Cengizhan
Most of the time, people say that there are many IDEs and they support highlight things or Intellisense whatever. When I see "isDone, isFinished" variable name on code review, automatically I expect that its type as boolean.
Anonymous
hello friend am glad to be in your group i want to learn the program c if you now how i can do please help me thanks
Anonymous
I am new in C programming Currently on Pointers.. Can anybody please explain how below program output is geeks main( ) { char g[ ] = "geeksforgeeks"; printf("%s", g + g[6] - g[8]); }