Roxifλsz 🇱🇹
Are you certain that the exact line you posted is causing the segfault?
BinaryByter
according to the VSC debugger (gdb) yep
Roxifλsz 🇱🇹
according to the VSC debugger (gdb) yep
Try running valgrind memcheck on the executable, it should tell you if something wasn't allocated or something like that
BinaryByter
let's do that
Ludovic 'Archivist'
why the fuck does this line fucking produce a segfault?
Because the vector is not initialized maybe
BinaryByter
infact, I use it many times before pushing back
BinaryByter
struct tape { int estimated_size = 0; std::vector<char> tape_vector; int read_position = 0; tape(int es_size) : estimated_size(es_size), tape_vector(estimated_size, 0) { } ~tape() { } inline void write_cell() { std::cout << tape_vector[read_position]; } inline void input_cell() { std::cin >> tape_vector[read_position]; } inline void increase_cell_position() { read_position++; if (read_position >= tape_vector.size()) tape_vector.push_back(0); } inline void decrease_cell_position() { read_position--; } inline void increment_cell() { tape_vector[read_position]++; } inline void decrement_cell() { tape_vector[read_position]--; } };
olli
Using clang++ should link against libstdc++ as g++ does
olli
valgrind mainly complains because of uninitialized variables
Then you should initialize them, and what are the minor complaints?
BinaryByter
wait lemme restart coding :D
BinaryByter
it doesn't complain anymore
BinaryByter
though I don't get the sigsev anymore 🤔
BinaryByter
wait
BinaryByter
my vector is an invalid read?
BinaryByter
dafaq why?
BinaryByter
Like I don't do anything invalid with it
BinaryByter
or do i?
BinaryByter
BinaryByter
please make up your mind, do you want to sigsev or "double free or corruption"?
Jussi
or do i?
Yeah, you should use C,
BinaryByter
Yeah, you should use C,
You have no ideo of anything go back to school
Anonymous
printf("lots of format specifying", shit_here) vs std :: cout <"It works, but you don't need to know how!" « std :: endl; ?
Morgan
/hey
klimi
/hey
はい
Morgan
English ?
klimi
yes
klimi
はい
@linuxer4fun tell him that this is english T.T
BinaryByter
English ?
That's english you dumbfuck
klimi
thanks
klimi
Morgan
Morgan
That's not English
klimi
That is english
klimi
ばか
Morgan
Why did you abuse me when I said it's not English
Morgan
You're mad
klimi
you're mad
Anonymous
Holly C++
klimi
std::endl?
Jussi
Holly C++
That's C++ optimizarion
Anonymous
std::endl?
It's got wrapped
Anonymous
That level of optimization
klimi
Jussi
Pure C++ level optimization right here
Anonymous
Compiler doing too much
klimi
xD
Jussi
Yet @linuxer4fun told us many times that c++ compilers are the future
Jussi
Well, I guess future cpus have 6x clock speeds so they can execute as fast as old C code on a legacy processor
klimi
well
klimi
i dont think this really matters tho
klimi
std cout is opening stream
Jussi
Oh ok, so only those parts matter where C++ is doing better :)
Jussi
Okay sure
Anonymous
I understood, C vs C++ war is based on personal preference, like in linux world, best distro war exists
Anonymous
well
Anonymous
xD
Anonymous
Well, use the right tool :)
Anonymous
xD
klimi
youtube
Anonymous
there is only one best distro tho
That's Arch obviously, btw I don't use Arch!
klimi
No
klimi
Fedora
Anonymous
Fedora
No Redhat. Fedora is bleeding
klimi
anyone game of 囲碁?
klimi
klimi
wanna bandage?
Anonymous
wanna bandage?
No, I lick my wounds xD
klimi
cool
klimi
some salt?
Anonymous
some salt?
That's what kids use, give me some phenols
klimi
i need some youtube meme vim