BinaryByter
Mainly because having a prototype gives a very clear picture to the reader
BinaryByter
so he doesnt have to read through all the shitcode in order to see what a class does and how he interacts with it
BinaryByter
Good
BinaryByter
have you stopped putting your notes into a big printf statement?
BinaryByter
have you stopped using printf in C++?
BinaryByter
xD
BinaryByter
well. it doesnt teach you anything
BinaryByter
its just that it's super hard to keep it correct and all
Avezy
BinaryByter
Avezy
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0645r0.html
There is also a standards proposal for this
Stanislav
Avezy
Ah nice
Avezy
And it seems like it was already reviewed by the comittee
Avezy
http://www.zverovich.net/2018/06/15/iso-cpp-meeting-rapperswil.html
Stanislav
Ибраги́м
Ибраги́м
Everything I do recently depends on this guy
Dima
lol
Dima
I like that lib
Dima
universal formats
Dima
lol >= 3k commits for that little lib
Mat
Anonymous
Which are affordable colleges for masters program/direct PhD in data science/machine learning/data analytics/computer science/open source?
Zinc
Today I just complete a tutorial which consisted of creating a program to find the area of a circle using functions. Although the instructions already displayed how to create the program, I gained a better understanding of more functions such as if statement, cout, and return value. I also was able to compile it successfully and execute. Feelsgood.
Kelvin
Satan
Satan
#googleit
Marie
#googleit
http://www.fuckinggoogleit.com/
Zinc
Very humorous
D
Can one explain friend function in c++ ?
Ибраги́м
Feng
BinaryByter
On the other hand: dudes, I need help.
My algo depends on a variable not being initialized. as soon as I initialize it, the algo won't work and the Neural Network's error will converge to the average
BinaryByter
BinaryByter
I have double and triple and quintuple checked the algorithm
BinaryByter
use modern header guards
BinaryByter
you declare Questions but you never define it
BinaryByter
use
#pragma once
at the top of your header
Anonymous
/KicKme
Marie
BinaryByter
you have to define it before using it
olli
BinaryByter
olli
your Problem is here
class Questions;
Questions Askaway;
you create an object of a class, that you have not yet defined
BinaryByter
you have to define the class in the header itself and define it's functions in a c++ file
olli
olli
which is #pragma once
#pragma pragma_params
Implementation defined behavior is controlled by #pragma directive.
BinaryByter
BinaryByter
Oh I see
so the standard compliant ones are the
#ifndef a
#define a
#endif
BinaryByter
right?
olli
yes, exactly.
BinaryByter
So I should change that in ZENeural
BinaryByter
after i've fixed the bug with the undefined variable ;_;
olli
Most compilers will probably recognize #pragma once but that is not defined
BinaryByter
BinaryByter
so if I want to write a compiler and I want to add some cool dank new features to C++, i'll use pragma
olli
a.hpp
class A {
public:
void foo();
};
a.cpp
#include "a.hpp"
void A::foo() {
// your code
}
main.cpp
#include "a.hpp"
int main() {
A a; // create your object here
a.foo(); // call your function
}
i woudl suggest a layout similar to the above
To use your class it should be in a header file, that can be included. Only after you told your compiler how your class looks like, you can instantiate it.
The implementation might go into a seperate source file, that includes that header and implements the functions.
your main code includes the header, to make use of the class.
It's preferable to construct the object with a minimal lifetime. So create it in the main function and use it there.
BinaryByter
BinaryByter
BinaryByter
😢
BinaryByter
are the C++ casts member of the stl?
BinaryByter
reinterpret_cast <type> looks very much like a function in a standard library
BinaryByter
but the examples I've seen don't include the stl
BinaryByter
and the wikipedia page on operators in C++ lists them as own operators
BinaryByter
@ollirz
BinaryByter
BinaryByter
ugly ugly ugly
olli
why?
BinaryByter
They look like they are normal template functions
BinaryByter
which makes C++ another candidate for the PHP evolution
BinaryByter
imho
olli
But I personally don't see a problem there
BinaryByter
it doesnt preserve clearness of intent
BinaryByter
especially when there's a stl wrapper
olli
I think it acutally does by including the _cast prefix